Professional Documents
Culture Documents
Before we can start to get the coding of our game done we need to understand the logic behind it.
Each of the line in this program will be explained in detail in the table below.
To create this game got easier when we put our objective before us. Don’t start a project to end up
somewhere else. Always have a clear goal in front of you.
Sub Main()
Dim secretNumber AsInteger = 30
Console.WriteLine("Hello User, Welcome to Visual Basic Number Guessing Game")
Console.WriteLine("Please enter your first guess = ")
Dim userGuess AsInteger = Console.ReadLine()
While userGuess <> secretNumber
If userGuess < secretNumber Then
Console.WriteLine("Your Guess is too low")
Console.WriteLine("Please enter your guess = ")
userGuess = Console.ReadLine()
EndIf
If userGuess > secretNumber Then
Console.WriteLine("Your Guess is too high")
Console.WriteLine("Please enter your guess = ")
userGuess = Console.ReadLine()
EndIf
If userGuess = secretNumber Then
Console.WriteLine("you win the game")
Console.ReadLine()
EndIf
EndWhile
EndSub