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
Differencebetween Def Func(Var) and Def Func=(Var)
Can Ruby Tell If It Is Called from an Interactive Shell or Cron
How to Display Error Messages in a Multi-Model Form with Transaction
How to Display a Link to Individual Microposts? (Ruby on Rails 3)
Assets Precompiling Error with Jquery UI Plugin
How to Sign Out in a Rails App, Using Devise Gem, No Route Matches /Users/Sign_Out
How to Extract Specific Elements from an Array
Delayedjob: "Job Failed to Load: Uninitialized Constant Syck::Syck"
With Nokogiri I am Getting Error "Initialize': Getaddrinfo: No Such Host Is Known. (Socketerror)"
When Passing a Ruby Array as an Argument, Why Does '<<' Append While '+=' Does Not
Ruby on Rails - Error Making New App (Rb:55:In 'Require')
Ruby Implementation Win32API Get Mouse Scroll/Wheel Input
Ruby: How to Process a CSV File with "Bad Commas"