Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,520 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