Re: x.times dont work


#1

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


#2

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