Selection Flow Charts If statements Flow of Control The flow of control is a concept with which we’re already familiar. The concept of control relates to.

Download Report

Transcript Selection Flow Charts If statements Flow of Control The flow of control is a concept with which we’re already familiar. The concept of control relates to.

Slide 1

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 2

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 3

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 4

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 5

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 6

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 7

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 8

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 9

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 10

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 11

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 12

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 13

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process


Slide 14

Selection
Flow Charts
If statements

Flow of Control
The flow of control is a concept with which
we’re already familiar.
The concept of control relates to the machine
level in which a single instruction controls
the behaviour of the CPU.
The flow of control describes how control
passes from one instruction to the next.

Flow Charts
A handy way to map the logic of a program
is the Flow Chart.
Flow Charts use specific shapes to represent
computer actions and join these together
with arrows to show the flow of control.
Each type of action is represented by a
specific shape.

Flow Chart Symbols
There is no single standard for flow chart shapes,
but there is a widely used core set.
• The start and end of a program are represented by
lozenges, ovals or rounded rectangles.
• The flow of control is represented by arrows.
– An arrow coming from one symbol and ending at
another symbol represents that control passes in the
direction of the arrow.

Flow Chart Symbols
• Processing steps are represented by
rectangles.
• Input/Output are represented by a variety
of shapes, including parallelograms.
– Some programmers use different symbols for
input than for output.
– Some even use different symbols for different
types of input or output. (printer, screen,
speaker, etc.)

Charting the Flow of Control
Flow charts help
visualise the flow of
control.

Declare vars for
input and result

get input

The simplest form is
sequence.

produce result from
input

show result

Note the use of alternate symbols
for I/O.

Flow Chart Symbols
Frequently, a program
will need alternative
logic paths, one for
some data, and
another for other data.
In a flow chart a branch
in the logic path is
represented by a
diamond.

Flow Chart Symbols
• A condition (or decision) is represented by
a diamond (rhombus).
• These typically contain a Yes/No question
or True/False test.
• This symbol is unique in that it has two
arrows coming from it:
– one corresponding to Yes (or True)
– and one corresponding to No (or False).

Branches in VB
A branch in the logic of a VB program is
created by the If statement.
If Then

End If

If Then

If condition Then
‘body
End If

True
Condition

False

Process

If …Then…Else
If condition Then
‘body
False
Else
‘body
Process
End If

True
Condition

Process

ElseIf
If condition Then
‘body
False
ElseIf condition Then
‘body
False
Else
Condition
‘body
Process
End If

True
Condition
True

Process
Process

Else If
If condition Then
‘body
Else
If condition Then
‘body
False
Else
‘body
Process
End If
End If

False

True
Condition

True
Condition

Process

Process

Nested Ifs
If condition Then
False
If condition Then
Condition
‘body
False
True
False
Else
Condition
‘body
End If
Process
Process
Process
Else
If condition Then
‘body
Else
‘body
End If
End If

True

True
Condition

Process