+ 1

String Interpolation-problem

a = 5 b = 2 puts "The sum is #{a+b}" how to solve the following: a = .567 b = .789 puts "The sum is #{a+b}"

9th Sep 2018, 12:11 PM
kp kalia
kp kalia - avatar
2 Answers
+ 3
The compiler tells you what to do. Put a 0 before the . a = 0.567 and b = 0.789
9th Sep 2018, 12:29 PM
Paul
Paul - avatar
0
thanks it is right to explain it
10th Sep 2018, 1:03 AM
deepak sharma
deepak sharma - avatar