Yesterday I introduced a bug in one of my scripts after accidentally
deleting av space. It took me quite I while to find where the bug was,
but I still can’t understand why the missing space leads to a
different result. Anyone out there that can explain it to me?
[email protected]:~$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
[email protected]:~$ irb
irb(main):001:0> elems = [‘foo’, ‘bar’, ‘baz’]
=> [“foo”, “bar”, “baz”]
irb(main):002:0> puts elems.count -1
irb(main):003:0> puts elems.count - 1
How does the missing space between the minus sign and the number 1
change the expression?
Any answers appreciated