is a global variable whose value, if set, is applied to every input expression.
$Pre
is a global variable whose value, if set, is applied to every input expression.
Details
- Unless $Pre is assigned to be a function which holds its arguments unevaluated, input expressions will be evaluated before $Pre is applied, so the effect of $Pre will be the same as $Post.
- $Pre is applied to expressions, while $PreRead is applied to strings which have not yet been parsed into expressions.
Examples
Basic Examples (2)
By default, $Pre is not defined, meaning the input is evaluated directly:
$PreSave input expressions in held form:
SetAttributes[saveinputs, HoldAll];
inputs = {};
saveinputs[new_] := (inputs = {inputs, HoldForm[new]};new);
$Pre = saveinputs;N[Pi]Solve[x ^ 5 - x + 1 == 0, x]Restore $Pre to its default:
$Pre=.The variable inputs holds the inputs in unevaluated form:
Flatten[inputs]Tech Notes
Related Guides
History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), $Pre, Wolfram Language function, https://reference.wolfram.com/language/ref/$Pre.html.
CMS
Wolfram Language. 1988. "$Pre." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$Pre.html.
APA
Wolfram Language. (1988). $Pre. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$Pre.html
BibTeX
@misc{reference.wolfram_2026_$pre, author="Wolfram Research", title="{$Pre}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/$Pre.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_$pre, organization={Wolfram Research}, title={$Pre}, year={1988}, url={https://reference.wolfram.com/language/ref/$Pre.html}, note=[Accessed: 13-June-2026]}