Answers for "ruby array of symbols shorthand"

0

ruby array of symbols shorthand

2.4.2 :001 > a = 1
2.4.2 :002 > %i{one two #{a}+three} # Interpolation is ignored
 => [:one, :two, :"\#{a}+three"]
2.4.2 :003 > %I{one two #{a}+three} # Interpolation works
 => [:one, :two, :"1+three"]
Posted by: Guest on March-19-2021

Browse Popular Code Answers by Language