Victor 'Zverok' Shepelev
9/25/2007 4:59:00 PM
From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf Of
SpringFlowers AutumnMoon
Sent: Tuesday, September 25, 2007 7:50 PM
>
> the following syntax error for "elif" is not caught? (should be elsif)
>
>def foo(i)
> if i < 0
> return "Less than 0"
> elif i == 0
> return "it is zero"
> else
> return "Greater than 0"
> end
>end
>
Rewrite indents this way to understand:
def foo(i)
if i < 0
return "Less than 0"
elif i == 0
return "it is zero"
else
return "Greater than 0"
end
end
The "problem line" is parsed as
elif(i == 0)
Interpreter doesn't complain on non-existent "elif" methods, because the
line just never evaluated.
V.