Initialize two variables on same line

This works, but you should know that it’s only safe for your situation because you’re using the variables for numbers, which are immutable in Ruby. If you tried the same thing with a string, for example, you could end up with some behavior you didn’t expect:

ruby-1.9.2-p180 :001 > foo = bar = "string"
 => "string" 
ruby-1.9.2-p180 :002 > foo.upcase!
 => "STRING" 
ruby-1.9.2-p180 :003 > bar
 => "STRING"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)