8 practice makes perfect bug?


I am able to call the by_three? method without using the question mark at the end is this just a bug?

I thought to call a method it has to be exact name?

def greeter(name)
  return "Hello " + name

def by_three?(number)
  if number % 3 == 0
    return true
    return false


I think you write the function like this:

def by_three?(n)
  return n % 3 == 0

I may be wrong, because I don't know that much about ruby, but I believe that the question mark is a type of If statement.
like it's going to return true if n is divisible by 3, and false if it's not...
I guess I'll try to look more into it, but my code does work for this function, and my explanation is the only one I can come up with.


Hi @programmer_1111 ,

Refresh the page, then submit your code again. Then you will see that it does not work.

After that, to fix it, change this ...


... to this ...


What explains this strange behavior? Quite likely, you had this recently ...

def by_three(number)

Codecademy remembers the function as it was defined by that name, by_three, as well as by the new name, by_three?. Refreshing the page removes remembered obsolete names, along with others, from memory, thereby enabling a valid reappraisal of your code.


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