mardi 28 juillet 2015

Ruby If Elsif Else block syntax

What's wrong with this block?

if item.nil?
   found = true
elsif item[:name] == name && item[:category] == category
   found = true
else
   i++
end

When I do syntax checking, I get

syntax error, unexpected keyword_end

but if I delete end then I get

syntax-error, unexpected end-of-input

Aucun commentaire:

Enregistrer un commentaire