top of page

Visual Basic : If Test Then Else Statement

Line No. [4] Dim userValue As String : Dimensions allocated space [Variable - userValue] to contain an Alphanumerical Value also called a String Value once it is inputed by the User.

Line No. [5] Tests the Input Value of the Variable userValue. If the test = True it then defaults to the next Line to execute the Values in Console.WriteLine and Console ReadLine in Line 6 and 7.

If Line No. 5 Test = False : The Program control defaults to Line 8 : Else If userValue = "2" then default to Line 9 and 10.

The same proceedings occur with Line 11. If Test = True then the Program will default to Line 12 and 13.

Line 14. Is the Else Statement. If all the entries do not equate to a Number from 1 to 3 . The Else Statement then attributes command to Line 15: Console.WriteLine("userValue of Value of 1-3 Unidentified"

 

 

bottom of page