Chapter 4


Home

Chapter 1

Chapter 2

Chapter 3

Chapter 4

Chapter 5

Chapter 6

Chapter 7

Chapter 8

Chapter 9

Chapter 10

Chapter 11

Chapter 12

Chapter 13

Chapter 14

Chapter 15

Table of Contents


Decision Making and Looping

The If-Then statement has three forms:

  1. If condition Then statements
  2. If condition Then
      statements if true
    End If
  3. If condition Then
      statements if true
    Else
      statements if false
    End If

If the condition tested is true, the statements immediately following are executed. If the condition is false, versions 1 and 2 would not execute any statements. Version 3 would execute the statements after Else.

An And statement is true only if both the left and right expressions are true.

An Or statement is true if either the right expression is true or the left expression is true, or if both are true.

Divisibility of a number by a divisor is tested with the following statement:

    If Number mod Divisor = 0 Then
      number is divisible by Divisor
    End If

The MultiLine property of a textbox automatically word wraps when the display line exceeds the width of the box.