Password as string Learn programming Visual Basic (VB.net)

Lesson:

Basic Data Types


Exercise:

Password as string


Objetive:

Write a Visual Basic (VB.net) program to ask the user for their username and password (both should be strings) and repeat it as many times as necessary until the entered name is "username" and the password is "password".


Code:

Imports System
Public Class exercise51
    Public Shared Sub Main()
        Dim user, password As String

        Do
            Console.Write("Enter a user: ")
            user = Console.ReadLine()
            Console.Write("Enter a password: ")
            password = Console.ReadLine()
        Loop While user <> "user" AndAlso password <> "password"

        Console.WriteLine("Bye!")
    End Sub
End Class

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.