This sort of thing has most probably been noted and reported by other
people before, but as a relative newcomer to ruby I found it amusing...

At a point in the code I was writing I found I wanted an 'alternative if',
so I glanced at the quick-reference and wrote something like this (the
actual code being more useful, of course):

 def tt x
  if x == :this
   return "got this"
  elseif x == :that
   return "got that"
  end
  ## ... more actions if neither is true
 end

and was totally flummoxed for half an hour or so because the second
{':that') action was never being executed!  No error messages, ever,
so I figured the syntax *must* be OK... (:-/)  [Ruby up to that point
had been superb at identifying errors.]

Then I finally went and re-read the docs a little more carefully...!

My typo in 'elsif' was of course never being caught because execution
never reached it.  (If I replace the 'return' with a non-exiting statement,
the error shows up at once, of course.)

[The experience inspired me to see how the construct is handled in
other languages.  None of them seem to agree here!  (C family: "else if";
Python: "elif", Algol: "ELSF"...)  And only my old idol Pop-11 [WHO?!]
actually *uses* "elseif".]

Oh well.  At least it's the sort of slip one doesn't repeat.

					-- Pete --


-- 
============================================================================
The address in the header is a Spam Bucket -- don't bother replying to it...
(If you do need to email, replace the account name with my true name.)