Wyo VB Lecture Notes

Objective #1: Write Boolean expressions.

Objective #2: Use If statements to ensure that certain statements are executed only when a given condition applies.

Objective #3: Use If Else and If ElseIf statements to select which of two sequences of statements will be executed, depending on whether a given condition is TRUE or FALSE.

Objective #4: Use the Mod operator to test divisibility.

6 is a factor of 24 since 24 Mod 6 = 0
10 is a factor of 100 since 100 Mod 10 = 0
2 is a factor of 8 since 8 Mod 2 = 0
3 is a factor of 9 since 9 Mod 3 = 0

The following statement tests to see if 4 is a factor of the variable num

If (num Mod 4 = 0) Then
    MessageBox.Show("yes")
End If

24 is a multiple of 6 since 24 Mod 6 = 0
100 is a multiple of 10 since 100 Mod 10 = 0
8 is a factor of 2 since 8 Mod 2 = 0
9 is a factor of 3 since 9 Mod 3 = 0

The following statement tests to see if 24 is a multiple of the variable num

If (24 Mod num = 0) Then
    MessageBox.Show("yes")
End If