Off-side Rule - Alternatives

Alternatives

The primary alternative to delimiting blocks, popularized by C, is to ignore whitespace and mark blocks explicitly with curly brackets (i.e. { and }) or some other delimiter. The main advantage of this is that it makes it possible for tools to correct the indentation automatically. A disadvantage is that if such a tool is not used, it is possible to have a program that works correctly but whose indentation leads a reader astray.

Lisp doesn't differentiate statements from expressions, and parentheses are enough to control the scoping of all statements within the language. As in curly bracket languages, the lengths of the whitespaces are ignored.

Another alternative is for each block to begin and end with explicit keywords. For example in Pascal blocks start with keyword begin and end with keyword end. In some languages (but not Pascal), this means that newlines are important (unlike in curly brace languages), but the indentation is not. In BASIC and FORTRAN, blocks begin with the block name (such as IF) and end with the block name prepended with END (e.g. END IF). The Bourne shell (sh, and bash) is similar, but the ending of the block is usually given by the name of the block written backward (e.g. case starts a conditional statement and it spans until the matching esac).

Read more about this topic:  Off-side Rule

Famous quotes containing the word alternatives:

    Clearly, society has a tremendous stake in insisting on a woman’s natural fitness for the career of mother: the alternatives are all too expensive.
    Ann Oakley (b. 1944)

    The last alternatives they face
    Of face, without the life to save,
    Being from all salvation weaned
    A stag charged both at heel and head:
    Who would come back is turned a fiend
    Instructed by the fiery dead.
    Allen Tate (1899–1979)

    The literal alternatives to [abortion] are suicide, motherhood, and, some would add, madness. Consequently, there is some confusion, discomfort, and cynicism greeting efforts to “find” or “emphasize” or “identify” alternatives to abortion.
    Connie J. Downey (b. 1934)