Ruby: "Unexpected Keyword_End"... But All Openers and Closers Match

Ruby: Unexpected keyword_end... but all openers and closers match

Write i ++ as i += 1 and number ++ as number += 1. Ruby don't support ++ or -- operators. Read this question No increment operator (++) in Ruby? and also read Why doesn't Ruby support i++ or i— (increment/decrement operators)?

unexpected keyword_end with every loop

There's no unary operator ++ in Ruby. You should have:

i += 1

unexpected tidentifier expecting keyword_end

You're using else if which works fine in other languages, but in Ruby represents 2 distinct conditionals. You probably want to replace it with elsif instead, which is the Ruby equivalent.



Related Topics



Leave a reply



Submit