I am really new to VB and have a question about loops. I am programming a console based text adventure and need to know how to make the wrong choice loop back to the selection. By wrong, I mean something that's not even a choice. Like below, when someone puts in '3'. I want it to say ("What is so hard about '1' or '2'. Pick a number between 1 and 2....") and then repeat the question with the choices. Any help is appreciated.
Console.WriteLine("Do you want to quit or get started? Type the corresponding number")
Console.WriteLine("and press ENTER to submit your choice.")
Console.WriteLine()
Console.WriteLine("1. Get Started!")
Console.WriteLine("2. No Thanks!")
Begin = Console.ReadLine()
If Begin = 1 Then
Console.WriteLine("Let's get started!")
Console.ReadKey()
ElseIf Begin = 2 Then
Console.WriteLine("See ya next time!")
Console.ReadKey()
Else
Console.WriteLine("What is so hard about '1' or '2'. Pick a number between 1 and 2....")
Console.ReadLine()
End If
PS. Sorry for no indentions. kinda new to the forum thing, too.
Console.WriteLine("Do you want to quit or get started? Type the corresponding number")
Console.WriteLine("and press ENTER to submit your choice.")
Console.WriteLine()
Console.WriteLine("1. Get Started!")
Console.WriteLine("2. No Thanks!")
Begin = Console.ReadLine()
If Begin = 1 Then
Console.WriteLine("Let's get started!")
Console.ReadKey()
ElseIf Begin = 2 Then
Console.WriteLine("See ya next time!")
Console.ReadKey()
Else
Console.WriteLine("What is so hard about '1' or '2'. Pick a number between 1 and 2....")
Console.ReadLine()
End If
PS. Sorry for no indentions. kinda new to the forum thing, too.