none
if then else RRS feed

  • General discussion

  • I AM LEARNING SMALL BASIC, PLEASE HELP !!

    I'm writing an if then statement for:

    displays "Please try again" when myUserInput is not greater than or equal to 1 or myUserInput is not less than or equal to 100.

    Thank you!!

    K
    Tuesday, October 27, 2009 12:18 AM

All replies

  • Can you copy and paste your program?  It's hard to help without enough context.
    Tuesday, October 27, 2009 1:58 AM
    Moderator
  • If/then/else is checking one condition. One time.

    You have to loop while your parameter is not OK.

    Something like this:

    myUserInput=TextWindow.ReadNumber()
    While (myUserInput<1) Or (myUserInput>100)
      TextWindow.WriteLine("Try again!")
      myUserInput=TextWindow.ReadNumber()
    EndWhile
    

    Grzesio
    Tuesday, October 27, 2009 10:48 AM