39
1
Option Strict On
2
Imports System
3
Public Module Module1
4
Public Sub Main()
5
'Prompt for my name
6
Console.Write("What is my name: ")
7
8
'Declare a variable to store the input
9
Dim input As String = Console.ReadLine()
10
11
'Loop while the input is not my name
12
Do While input <> "David"
13
'Indicate that they guessed wrong and to try again
14
Console.WriteLine("Nope, that is not it.")
15
Console.Write("What is my name: ")
16
17
input = Console.ReadLine()
18
Loop
19
20
'Indicate that they guessed correctly
21
Console.WriteLine("Good job! My name is David.")
22
23
'Reset the variable and prompt for the name at the end of the loop
24
input = String.Empty
25
Do
26
'Prompt for the name
27
Console.WriteLine("What is my name: ")
28
input = Console.ReadLine()
29
30
'Check if the input does not match my name
31
If input <> "David" Then
32
Console.WriteLine("Nope, that is not it.")
33
End If
34
Loop While input <> "David"
35
36
'Indicate that they guessed correctly
37
Console.WriteLine("Good job! My name is David.")
38
End Sub
39
End Module
Cached Result