I wad told to use brackets. I get the following behaviour when using a variable to call a function. From what I've read in the documentation, brackets aren't supposed to make any difference.
I have this:
def pr (arg1, arg2)
if arg2
puts arg1
end
end
This code results in unexpected ','
in front of the false
, but without brackets, it works.
for i in 1...4
pr (i,false)
end
This works:
for i in 1...4
pr i,false
end
for
, it doesn't normally get used. Instead, consider:4.times do |i|
(zero-indexed) or1.upto(4) do |i|
where you have a lot more control over how things iterate that way.