Forum: Ruby Re: x.times dont work

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6087a044557d6b59ab52e7dd20f94da8?d=identicon&s=25 Peña, Botp (Guest)
on 2006-04-26 09:59
(Received via mailing list)
On Behalf Of Dawid Skomski:

# irb(main):027:0> 3.times(puts "Hello!")
# (irb):27: warning: parenthesize argument(s) for future version
# Hello!
# ArgumentError: wrong number of arguments (1 for 0)
#         from (irb):27:in `times'
#         from (irb):27

replace parens with curly brace.

welcome to ruby.

kind regards -botp
3324a49b1605f0e2df7676ff64f5e712?d=identicon&s=25 Mohammad Ruby (mohammad)
on 2006-04-26 19:47
Peña, Botp wrote:
> On Behalf Of Dawid Skomski:
>
> # irb(main):027:0> 3.times(puts "Hello!")
> # (irb):27: warning: parenthesize argument(s) for future version
> # Hello!
> # ArgumentError: wrong number of arguments (1 for 0)
> #         from (irb):27:in `times'
> #         from (irb):27
>
> replace parens with curly brace.
>
> welcome to ruby.
>
> kind regards -botp

or you can put this,
3.times do
puts "hello!"
end
This topic is locked and can not be replied to.