Project

General

Profile

Bug #10279

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

The following gives syntax error on ruby 2.1.3

~~~ruby ~~~
h = { key: if true
"yes"
else
"no"
end }

puts h.inspect
~~~

~~~
/usr/local/rvm/rubies/ruby-2.1.3/bin/ruby x.rb
x.rb:1: syntax error, unexpected modifier_if
h = { key: if true
^
x.rb:3: syntax error, unexpected keyword_else, expecting end-of-input
~~~

~~~
/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby x.rb
{:key=>"yes"}
~~~

Back