Print "#{i}" vs. print i


I understand this is the correct answer for me to proceed.

However, I'm having a bit of trouble understanding why we have print "#{i}" in the code rather than print i. What do they mean and how do they differ? Thanks!

i = 20
loop do
  i -= 1
  print "#{i}"
  break if i <= 0


The phenomen is called interpolation
google search
== discussions / opinions ==
ruby interpolation
for instance


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.