selection statement
provides a way of choosing between two or more execution paths
control structure
a control statement and the collection of statements whose execution it controls
multiple-selection statement
allows the selection of one of any number of statements ( switch statement)
iterative statement
causes a statement to be executed zero, one or more times. often called a loop
loop variable
where the count value is maintained
how do functional languages control repetition?
instead of iteration, they use recursion
what is a block?
is a sequence of code that can be used with specially written methods to create useful constructs
selection statement design issues
iterative counter-controlled statement design issues
solution for nesting two-way selectors
use a static semantics rule rather than a syntatic entity
iterative statement design issues
- where should the control mechanism appear in the loop
multiple selection statement design issues
pretest loop
the test for loop completion occurs before the loop body is executed
posttest loop
the test for loop completion occurs after the loop body is executed
logically controlled loops design issues
- should the logically controlled loop be a special form of a counting loop or a separate statement?
purpose of user located loop control statements
allow programmers to choose a location for loop control other than the top or bottom of the body (break, goto)
user located loop control mechanism design issues
unconditional branch statement
transfers execution control to a specified location in the program