Department numbers: Difference between revisions
m
→{{header|Fortran}}
Line 515:
This uses the ability standardised in F90 of labelling a DO-loop so that its start and end are linked by usage of the same name, with this checked by the compiler. Further, in avoiding the use of the dreaded GO TO statement, the CYCLE statement can be employed instead with the same effect, and it too can bear the same name so that it is clear which loop is involved. These names prefix the DO-loop, and so, force some additional indentation. They are not statement labels and must be unique themselves. Notably, they cannot be the same text as the name of the index variable for their DO-loop, unlike the lead given by BASIC with its <code>FOR I ... NEXT I</code> arrangement.
The method is
PP:DO P = 2,7,2 !The police demand an even number. They're special and use violence.
SS:DO S = 1,7 !The sanitation department accepts any value.
|