Jordan Michaels
3/5/2006 12:16:00 AM
Eric Jacoboni wrote:
>Jordan Michaels <jordan@viviotech.net> writes:
>
>
>
>
>> elseif theNumber > theGuess
>> theResult = 2
>> elseif theNumber = theGuess
>>
>>
>
>elseif is not Ruby... try elsif instead.
>
>furthermore, equality is "==", not "=". Here, you assigns theGuess to
>theNumber. This assignment return the value of theGuess, hence always
>"true".
>
>
>
>>and here's my output when I run it:
>>
>>
>
>Strange. If i try to run your script, i get a :
>
>bla.rb:17: undefined method `elseif' for main:Object (NoMethodError)
>
>That's not the case for you ?
>
>
>
No, it was not the case, but that might have been helpful!
> ruby --version
ruby 1.8.2 (2004-12-25) [i586-linux]
I'm downloading 1.8.4 as I write this. We'll see if that doesn't give me
better error messages.
Thanks to all for your support and suggestions! Changing the "elseif" to
"elsif" did the trick. The script now works as intended. I agree with a
lot of your suggestions about equality (==), and using case instead of
if. When programming for clients I make a point to use the most
efficient and correct code as possible, but I'm just playing with this
at the moment. ;)
Thanks again. It's nice to have a friendly place to turn to when you
have questions!
Warm regards,
Jordan Michaels
Vivio Technologies