Control flow

IF and SELECT CASE decide, and the counted DO, DO WHILE and DO CONCURRENT loop. The part also covers the statement labels and GOTO of old code, the status a program leaves behind with STOP and ERROR STOP, and the two ways a program reads its environment: command-line arguments and environment variables.

3.1 IF, ELSE IF and block IF the one-line IF, the block IF, ELSE IF, nesting and the END IF that must match Open 3.2 SELECT CASE and CASE ranges CASE with a value, a range and a list, CASE DEFAULT, and a character selector Open 3.3 Counted DO loops DO i = 1, n, the stride, the trip count computed once, and the labelled DO of old code Open 3.4 DO WHILE and named loops DO WHILE, a loop that tests at the top, convergence loops and names on loops Open 3.5 EXIT and CYCLE leaving a loop early, skipping a round, the loop name in both, and a search that stops Open 3.6 DO CONCURRENT the concurrency-safe loop, the locality specifiers, and what the compiler may reorder Open 3.7 GOTO, labels and CONTINUE the statement label, GO TO, computed GOTO, CONTINUE and why new code has none Open 3.8 STOP, ERROR STOP and exit codes STOP with a code, ERROR STOP and its message, the status the shell sees, and STOP in a procedure Open 3.9 Command-line arguments COMMAND_ARGUMENT_COUNT, GET_COMMAND_ARGUMENT, a text-to-number read and a usage message Open 3.10 Environment variables GET_ENVIRONMENT_VARIABLE, its status argument, a default and a missing variable Open

Lessons