On Mon, Aug 19, 2002 at 07:24:38AM +0900, Paul J. Sanchez wrote:
> I'm a ruby newbie, but an old hand at programming (30 years, more than
> a dozen languages).  I'm constantly running afoul of "elsif" - as a
> native English speaker, my fingers really want to type "elseif".
> Usually the mistake shows up immediately, but not always.  For
> example, Ruby will parse the little test program given below without
> generating an error message, but the output surprised me until I
> tracked down my mistake.  No error message is generated until you test
> the power function with a negative exponent.
> 
> To me, that missing "e" is a human factors issue.  I realize that
> changing the syntax would break virtually all existing code, but would
> it be possible to add "elseif" as an alternate syntax?  Or am I making
> a mountain out of a mole hill?
> 
> 
Hmm. don't know much about the possibility of adding the
keyword elseif, but you may want to try '-w' to ruby.

I changed the first line to #!/usr/bin/env ruby -w

to get:

else.rb:13: warning: elseif (...) interpreted as method call
else.rb:11: warning: useless use of / in void context
0: 1
1: 1
2: 1
3: 1
4: 1
5: 1
6: 1
7: 1
8: 1
9: 1

Jim

-- 
Jim Freeze
If only I had something clever to say for my comment...
~