On Wed, Mar 07, 2007 at 08:28:43PM +0900, 7stud 7stud wrote:
> > I tried it, and I got an error for the 'elseif'.  Why is that?  If the 
> > first branch succeeds, why is the elsif branch even evaluated?
> 
> Hmm...I think I get it: Ruby doesn't realize elseif is another branch, 
> it just thinks its the next statement after the if statement.  But as 
> far as I know, all if statements are terminated with 'end'.

And yours is.

Add some spaces at the front of the 'elseif' line, so that it aligns with
the 'puts "..."' on the line above. Then you'll see how Ruby is interpreting
your code.

Unlike python, Ruby doesn't *force* you to align your source in a particular
way.