Easy Ruby Question - Help Needed


In the editor, set the variables:
sum equal to 13 + 379
product equal to 923 * 15
quotient equal to 13209 / 17
Print each variable to the console using puts if you want to see the results.

My answer:
sum = 13+379
product = 923*15
quotient = 13209/17

Okay, I got that right.
However, how can I use “puts” to see the results?
On line 4, I’ve tried doing: “puts sum, product, quotient” (didn’t work)


you have to use string interpolation:

types_of_people = 10
x = "There are #{types_of_people} types of people."

or you can use + to join strings, but then you would have to convert .to_s (this converts to string)


A bit early to introduce that concept. They’re still on variables.

Quotes are for strings, only. Variables are identifiers that are never written in quotes.

puts sum
puts product
puts quotient


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