Monday 29 August 2011

Use While to read user input

Sub Main()
        Console.WriteLine("Please enter 'q' to quit...")
        Dim strInput As String = Console.ReadLine()

        While (strInput <> "q")
            Console.WriteLine("You typed " & strInput)
            Console.WriteLine("Please enter 'q' to quit...")
            strInput = Console.ReadLine()
        End While
        Console.WriteLine("Quitting now.")

    End Sub

No comments:

Post a Comment