Read user input using While loop in Vb.Net
In this article I describe the process of reading user input by using while loop
As we have now written some text to forcing the user to inter values to move on the next step of the program this user inputs stored virtually in the program and produced the desired output. Now for read this user inputs we need some specific code sniped as like While loop statement, in this statement the task will repeated until the given condition does not reached.
Syntax
While [condition][loop body]
End WhileWhile ..End while loop execute the body(the source code within while and end while statement) until it meets the specified condition.
Examples
Module Module1
Sub Main()
Console.WriteLine("Please enter 'e' to exit")
Dim Input As String = Console.ReadLine()
While (Input <> "e")
Console.WriteLine("Typed value is: " & Input)
Console.WriteLine("Please enter 'e' to exit")
Input = Console.ReadLine()
End While
Console.WriteLine("press enter to exit.")
Console.ReadLine()
End Sub
End Module
OUTPUT
CONCLUSION
This article helps you to understand that how you can read the user input by using While loop in VB.NET.