Microsoft Small Basic

Program Listing:
Embed this in your website
'Neil Busse

Playing = "True"
'start:
While Playing' = "True" 'If Playing <> "True" Then GoTo end

  TextWindow.WriteLine("Guess a number between 1-100")
  guess = Math.GetRandomNumber(100)
  NotCorrect = "True"
  numguess = 0
  'start2:
  While NotCorrect' = "True" 'If Not Correct <> "True" Then GoTo end2

    num2 = TextWindow.ReadNumber()

    numguess = numguess + 1
    'If the number is greater then the Random number then To high else to low.

    If num2 > guess Then
      TextWindow.WriteLine("Your guess is too high")
    ElseIf num2 < guess Then
      'If the you the right number then the program will tell you won.
      TextWindow.WriteLine("Your guess is too low")
    Else'If num2 = guess Then
      TextWindow.Clear()
      If numguess = 1 Then
        TextWindow.WriteLine("It took you: 1 try")
      Else
        TextWindow.WriteLine("It took you: " + numguess + " tries")
      EndIf
      NotCorrect = "False"
    EndIf
  EndWhile 'GoTo start2
  'end2:
  TextWindow.WriteLine("Do you want to play again? (y, n)")
  yes = TextWindow.ReadKey()
  If yes = "y" Then
    'Get new random number, and reset number of guesses then loop.
    TextWindow.Clear()
  Else'If yes <> "n"
    'if player doesnt want to play again then program close
    Playing = "False"
  EndIf
EndWhile 'GoTo start
'end:
Program.End()
Copyright (c) Microsoft Corporation. All rights reserved.