0

In Ruby, what does the Puts "a = #{a}" do?

I can't figure out what the #{a} does, or what the # does. Here is the full code: a = 0 until a > 10 puts "a = #{a}" a +=2 end

14th Feb 2017, 3:33 PM
Lucas
Lucas - avatar
2 Antworten
0
#{any_variable} inside the string just added value of this variable to string. i.e.: a = 8 puts "a = #{a}" # result: a = 8
14th Feb 2017, 3:50 PM
spiil hellig
spiil hellig - avatar
0
oh gotya its like %var% in batch code! By the way this was a comment off of Spiil hellig's comment
14th Feb 2017, 3:54 PM
Lucas
Lucas - avatar