Please enable JavaScript.
Coggle requires JavaScript to display documents.
Control Structures - Coggle Diagram
Control Structures
Statements
Control statements
Selection Statements
Two-way election
-
-
-
-
In languages such as Ada, Java, Ruby, and C#, the control
-
-
Single-way selection
-
Can select only a single statement; to select more, a goto must be used
Jump statements
Continue
-
A continue statement can only appear within the body of an
iterative statement, such as do, for, or while
goto
-
-
-
Some languages do not support goto statement (e.g., Java)
Break
Let's end an iterative (do, for, or while) statement or a switch
statement and exit from it at any point other than the logical end.
In Java, the break statement has two forms: labeled and unlabeled
Iteration statements
-
Counter-controlled loops
-
Some means of specifying the initial and terminal values of the loop variable, and the difference between sequential loop Variable values: Step size
Pascal for statement
-
-
After normal termination, loop var is undefined
-
The loop parameters can be changed, but they are evaluated just once, so it does not affect loop control
Ada for statement
-
Type of the loop var is that of the discrete range; its scope is the loop body (it is implicitly declared)
-
The loop var cannot be changed in the loop, but the discrete range can; it does not affect loop
control
-
FORTRAN 77 & 90 DO loop
Loop variable can be an integer, real or double. Loop parameters can be expressions and can evaluated to negative values.
Loop parameters are evaluated once at the beginning of the execution to generate an iteration count, after which loop parameters may be changed inside the loop
-
C & C++ for statement
-
Multiple statements may be used in a single expression in a for loop, separated by comma.
-
FORTRAN IV Do loop
-
Loop variable is undefined upon existing loop, but is defined upon abnormal termination.
-
Syntax:
DO label1 variable = initial, terminal, [stepsize]
-
-
-
-
-
-
-
-