From: dblack@... Date: 2006-10-17T09:12:12+09:00 Subject: Re: What is the reason for this syntax? Hi -- On Tue, 17 Oct 2006, Kevin Olemoh wrote: > When I said that I felt that the else if keyword was unnessecary what > I meant was that you should be able to do the following: > > if condition > #stuff > else > if condition > #stuff > end The problem is that you introduce the if/else ambiguity into Ruby: if false a else if true b else c end Does this result in b or c? The answer is that there's no answer: a rule has to be decided upon (like that an else goes with the most recent if, or the least recent if, or whatever). Ruby doesn't have this ambiguity, because every if has an end -- and if you want to cascade conditions, you can use elsif. David -- David A. Black | dblack@wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org