makersacademy/problem-solving

undefined method

Closed this issue · 5 comments

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

screenshot 12

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

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

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.

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.

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