December 2001
Beginner
976 pages
22h 4m
English
The If statements is one of the most common Visual Basic statements. It allows you to execute one or more statements only when a specific condition is met. This condition is a Boolean expression that will evaluate to True or False. Let's look at an example:
Sub Main()
Console.Out.WriteLine("Enter a value for i and press <ENTER>: ")
Dim i As Integer
i = CInt(Console.In.ReadLine())
Console.Out.WriteLine("Enter a value for j and press <ENTER>: ")
Dim j As Integer
j = CInt(Console.In.ReadLine())
If i < j Then
Console.Out.WriteLine("i is less than j")
End If
Console.Out.WriteLine("Press the <Enter> key to end the program")
Console.In.ReadLine()
End Sub
These example declare two Integer variables i and j and gets some values for ...
Read now
Unlock full access