I wonder why it is displayed a?
a
if true puts 'true' else puts 'false' a = 123 end puts a # no error # or # my_hash = {key: a} # puts my_hash # :key => nil
But this causes an error, although "true" will be displayed
if true puts 'true' else puts 'false' a = 123 end puts a2 # boooooom
The link ainside ifhas the effect of declaring it as a variable if there is no method for the object a=.
if
a=
Ruby , , . , , . , .