Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Basics (Retired) Ruby Numbers Multiplication and Division

Quinton Casburn
Quinton Casburn
15,201 Points

Having trouble understanding this question

The question is stated as follows: Set the variable product to be a multiple of the variables a and b.

I am being asked to set product to the sum of a and b because "and" signifies addition of the variables a and b. Then to set the variable product to be a multiple of that addition. The exponent value is not noted so I am assuming you are expected to make one up.

Unfortunately this code is not correct and I'm not quite sure if I am just not reading the question incorrectly or something else.

variable.rb
a = 6
b = 2
sum = a + b
product = sum ** 2

1 Answer

andren
andren
28,558 Points

You are indeed misunderstanding the question, specifically you have read far more into the use of the word "and" than was intended. They just want you to set product equal to the result of multiplying a and b together. In other words they just want product to be a multiplied with b. Also in Ruby ** is used to raise a number to the power of something, not to multiply a number. To multiply you just use *. Like this:

a = 6
b = 2
product = a * b
Quinton Casburn
Quinton Casburn
15,201 Points

Thanks for your help Andren!
I just finished a college algebra class so, I guess my brain is a little fried. LOL