Block
[{x, y, ...}, expr]Block
[{x=$x_0$, y=$y_0$, ...}, expr]n = 10
Block[{n = 5}, n ^ 2]
n
Values assigned to block variables are evaluated at the beginning of the block.
Keep in mind that the result of Block
is evaluated again, so a returned block variable
will get its original value.
Block[{x = n+2, n}, {x, n}]
If the variable specification is not of the described form, an error message is raised.
Block[{x + y}, x]
Variable names may not appear more than once:
Block[{x, x}, x]