Michael Michael - 4 years ago 101
Ruby Question

What's the difference between keyword_end and end-of-input in ruby?

Sometimes, I ran into an error like this in ruby:

syntax error, unexpected keyword_end, expecting end-of-input


So, I want to know the difference between
keyword_end
and
end-of-input

Answer Source

keyword_end implies that you had a block of code with a missing end.

def fun(f)
    puts "Oops!"

End-of-input implies that you have already closed up blocks of code with one too many end keywords.

def fun(f)
    puts "Okay..."
end
end
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download