Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 Selection Flow Charts If statements

2 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.

3 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.

4 Flow Chart Symbols There is no single standard for flow chart shapes, but there is a widely used core set. Start and end symbols, represented as lozenges, ovals or rounded rectangles. Arrows, showing the "flow of control". An arrow coming from one symbol and ending at another symbol represents that control passes in the direction of the arrow.

5 Flow Chart Symbols Processing steps, represented as rectangles. Input/Output, represented as parallelograms. –Some programmers use different symbols for input than output. –Some even use different symbols for different types of input or output. (printer, screen, speaker, etc.)

6 Charting the Flow of Control Flow charts help visualise the flow of control. The simplest form is sequence. Declare vars for input and result get input produce result from input show result

7 Flow Chart Symbols Frequently, a program will need alternative logic paths, one for some data, and another for other data. Flow Charts represent a branch in the logic path with a diamond.

8 Flow Chart Symbols Conditional (or decision), represented as 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 out of it, one corresponding to Yes or True, and one corresponding to No or False.

9 Branches in VB6 A branch in the logic of a VB6 program is created by the If statement. If Then … End If

10 If Then If condition Then ‘body End If Condition True False Process

11 If …Then…Else If condition Then ‘body Else ‘body End If Condition TrueFalse Process

12 ElseIf If condition Then ‘body ElseIf condition Then ‘body Else ‘body End If Condition TrueFalse Process Condition TrueFalse Process

13 Else If If condition Then ‘body Else If condition Then ‘body Else ‘body End If Condition TrueFalse Process Condition TrueFalse Process

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


Download ppt "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."

Similar presentations


Ads by Google