8. Not sure whats wrong here


#1



https://www.codecademy.com/courses/ruby-beginner-en-ET4bU/1/4?curriculum_id=5059f8619189a5000201fbcb#


For whatever reason i am getting multiple error messages that i do not understand. All the code looks like it should work for me but somehow i am still getting errors. Any help is greatly appreciated as i am excited to learn but stuck in the mud right now. Here's the error messages.

(ruby):8: warning: else without rescue is useless
(ruby):4: syntax error, unexpected tEQ
if number % == 0
^
(ruby):9: syntax error, unexpected keyword_end, expecting $end


def greeter(name)
    return "Hello, " + name
end
def by_three(number)
    if number % == 0
        return true
    else
        return false
    end 
end


#2

Missing a value after the operator.


#3

I changed the code to this:

def greeter(name)
return "Hello, " + name
end

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

by_three(6)
greeter("Trevor")

But i am now getting an error saying 'Oops try again, did you define the by_three method?"


#4

NEVERMIND!!! I forgot the question mark! Thank you so much for your help!


#5

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