Saturday 14 September 2013

How to implement Interpolation in Ruby

                                  Interpolation


x=10
y=30
puts "#{x}+#{y}=#{x+y}"

Output :
10+30=40



You can put expression  even logic directly into string

puts "100*5=#{100*5}"

Output :
100*5=500

No comments:

Post a Comment