# Block

Block[{vars}, expr]
temporarily stores the definitions of certain variables, evaluates expr with reset values and restores the original definitions afterwards.
Block[{x=x0, y=y0, ...}, expr]
assigns initial values to the reset variables.

• 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]