Couple of things: puts "sum" just outputs the string sum not the value of the variable. If you'd like that you need to do something like puts "#{sum}" or, simply puts sum .
As for the addition, I'm not sure if you are looking to do string concatenation or a value sum. If you are looking to do concatenation then try sum = price + row[0] . If you want to add the values, then possibly sum = price.to_i + row[0].to_i (or .to_f , depending on your needs).
L7Sqr
Practically a Posting Shark
866 posts since Feb 2011
Reputation Points: 253
Solved Threads: 155
Skill Endorsements: 7
Question Answered as of 1 Year Ago by
L7Sqr