makersacademy / problem-solving

For problem-solving during the PreCourse
6 stars 2 forks source link

undefined method #155

Closed T-Miller0 closed 6 years ago

T-Miller0 commented 6 years ago

Hey guys, I keep getting undefined method "number". Any ideas on what to do?

screenshot 12

jonurry commented 6 years ago

I think that you need to look at where you are placing the brackets on line 21. At the moment, ruby is interpreting 'number' as a method rather than a variable.

m-rcd commented 6 years ago

(number % 3 == 0) && (number % 5 == 0) try doing that , should work. Let me know if still not working :)

T-Miller0 commented 6 years ago

Hey Marianne, that still returns the error. I have removed the brackets and the error now has gone. There must be something missing in my code because it isn't puting FizzBuzz, so will have to play around with it.

jonurry commented 6 years ago

Think about the order in which you are doing the modulo (%) comparisons. If (number % 3 == 0) is true then you may never get to the 'FizzBuzz' comparison on line 21.

T-Miller0 commented 6 years ago

Thanks Jon, Iv managed to sort the code out. I am just getting some errors off of format now