Dim a As Integer
Dim b As Integer
a = 3
b = 4
If a > b Then
MsgBox ("a is greater then b")
Else
MsgBox ("b is greater then a")
End If
if statement where it's either or num = Int(Text1.Text) 'Input
If (num > 0) Then
strReply = "You have a car!"
Else
strReply = "You don't have a car!"
End If
An if statement where many decisions are made
intInput = Val(System.Console.ReadLine())
If intInput = 1 Then
System.Console.WriteLine("Thank you.")
ElseIf intInput = 2 Then
System.Console.WriteLine("That's fine.")
ElseIf intInput = 3 Then
System.Console.WriteLine("Too big.")
Else
System.Console.WriteLine("Not a number I know.")
End If
A case statement
Dim grade As String
Private Sub Compute_Click( )
grade=txtgrade.Text
Select Case grade
Case "A"
result.Caption="High Distinction"
Case "A-"
result.Caption="Distinction"
Case "B"
result.Caption="Credit"
Case "C"
result.Caption="Pass"
Case Else
result.Caption="Fail"
End Select
End Sub
No comments:
Post a Comment