This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Built-in Functions / Programming / Scoping /


FilledSmallSquare Block[x, y, ... , expr] specifies that expr is to be evaluated with local values for the symbols x, y, ... .

FilledSmallSquare Block[x = , ... , expr] defines initial local values for x, ... .

FilledSmallSquare Block allows you to set up an environment in which the values of variables can temporarily be changed.

FilledSmallSquare When you execute a block, values assigned to x, y, ... are cleared. When the execution of the block is finished, the original values of these symbols are restored.

FilledSmallSquare Block affects only the values of symbols, not their names.

FilledSmallSquare Initial values specified for x, y, ... are evaluated before x, y, ... are cleared.

FilledSmallSquare You can use Block[vars, body /; cond] as the right-hand side of a transformation rule with a condition attached.

FilledSmallSquare Block has attribute HoldAll.

FilledSmallSquare Block implements dynamic scoping of variables.

FilledSmallSquare Block is automatically used to localize values of iterators in iteration constructs such as Do, Sum and Table.

FilledSmallSquare See Section 2.7.6.

FilledSmallSquare See also: Module, With, CompoundExpression.

FilledSmallSquare New in Version 1.

Further Examples