Tutorial by Examples

The if construct (called a block IF statement in FORTRAN 77) is common across many programming languages. It conditionally executes one block of code when a logical expression is evaluated to true. [name:] IF (expr) THEN block [ELSE IF (expr) THEN [name] block] [ELSE [name] block] ...
A select case construct conditionally executes one block of constructs or statements depending on the value of a scalar expression in a select case statement. This control construct can be considered as a replacement for computed goto. [name:] SELECT CASE (expr) [CASE (case-value [, case-value] .....
A do construct is a looping construct which has a number of iterations governed by a loop control integer i do i=1, 5 print *, i end do print *, i In the form above, the loop variable i passes through the loop 5 times, taking the values 1 to 5 in turn. After the construct has completed th...
The where construct, available in Fortran90 onwards represents a masked do construct. The masking statement follows the same rules of the if statement, but is applied to all the elements of the given array. Using where allows operations to be carried out on an array (or multiple arrays of the same s...

Page 1 of 1