From: Summercool Date: 2007-09-11T09:05:06+09:00 Subject: Re: is there a one liner to initialize a variable to 1, or increment by 1? On Sep 10, 4:34 pm, Philip Hallstrom wrote: > foo = foo.to_i + 1 > > would work as nil.to_i == 0 I think it was also in Perl that $foo++ will work if $foo is not defined, then it will be just treated as 0. but if "use strict" then it won't work... but the code is more robust that way so Ruby is like it will impose the strict for code robustness...