Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Inequalities in Small Basic... Help!?

Ok, I'm writing a program for class that's supposed to take text input from the user (a "guess"), convert that to uppercase (to compare easier) and then decide if the user's input matches the word they're supposed to be guessing (in this case "EUGENE") Everything works fine, except I'm trying to use a while loop to re-prompt and get a new guess if the user inputs anything other than "Eugene" and I can't for the life of me figure out how to write the conditional. I would have thought it would be =! (for does not equal) but that spits an error at me. I can't find any help on the internet, so I'm hoping maybe some smart programming people will be able to tell me what to do.

Alternatively, maybe there's a better way to do this? Aw, heck, here's my code:

GUESS_CORRECT = "EUGENE"

TextWindow.Write("Enter your guess:")

Guess = TextWindow.Read()

Guess = Text.ConvertToUpperCase(Guess)

While (Guess =! GUESS_CORRECT)

TextWindow.WriteLine("Sorry, that's not it")

TextWindow.Write("Enter your guess:")

Guess = TextWindow.Read()

Guess = Text.ConvertToUpperCase(Guess)

EndWhile

If Guess = GUESS_CORRECT Then

TextWindow.Write("You got it!")

EndIf

Seriously, Small Basic is too ridiculously simple or something. Helps?

Update:

Holy moly! It's so simple! THANK YOU!

1 Answer

Relevance
  • Anonymous
    10 years ago
    Favorite Answer

    Most BASICs recognise <> as not equal to... It is less than or greater than the value and so not equal to the value.

    While (Guess <> GUESS_CORRECT)

Still have questions? Get your answers by asking now.