EchoEvaluation[expr]
prints expr before evaluation, then prints the result after evaluation and returns that result.
EchoEvaluation[expr,label]
prepends label when printing expr before and after evaluation.
EchoEvaluation[expr,label1label2]
prepends label1 before evaluation and label2 after evaluation.
EchoEvaluation[expr,labels,f]
prints expr before evaluation, then evaluates expr to the result res and prints f[res].
EchoEvaluation[expr,labels,gf]
prints g[expr] before evaluating expr and then f[res] after evaluation.
EchoEvaluation
EchoEvaluation[expr]
prints expr before evaluation, then prints the result after evaluation and returns that result.
EchoEvaluation[expr,label]
prepends label when printing expr before and after evaluation.
EchoEvaluation[expr,label1label2]
prepends label1 before evaluation and label2 after evaluation.
EchoEvaluation[expr,labels,f]
prints expr before evaluation, then evaluates expr to the result res and prints f[res].
EchoEvaluation[expr,labels,gf]
prints g[expr] before evaluating expr and then f[res] after evaluation.
Details
- EchoEvaluation is a variant of Echo that prints an expression both before and after evaluation.
- EchoEvaluation has attribute HoldFirst.
- EchoEvaluation[expr,labels,f] is effectively equivalent to EchoEvaluation[expr,labels,Unevaluatedf].
- The expression before evaluation is shown in a tooltip when hovering over the result.
Examples
open all close allBasic Examples (3)
Print an intermediate computation before and after evaluation:
expr1;EchoEvaluation[x = 1 + 1];expr2Print an intermediate evaluation with labels:
expr1;x = EchoEvaluation[1 + 1, "sum:" -> "result:"];expr2Report a property of the result of evaluation:
expr1;x = EchoEvaluation[FactorInteger[2 ^ 50 - 1], "input:" -> "factors:", Length];expr2Scope (5)
Print an expression before and after evaluation:
EchoEvaluation[2 ^ 3]Prepend labels before and after evaluation:
EchoEvaluation[Sum[1 / 2 ^ n, {n, Infinity}], "sum:" -> "result:"]Specify print functions for before and after evaluation:
EchoEvaluation[b + a, "input:" -> "framed:", MakeBoxes -> Framed]EchoEvaluation can be nested:
EchoEvaluation[Accumulate[EchoEvaluation[Reverse[EchoEvaluation[Range[10]]]]]]To avoid printing nested EchoEvaluation expressions, use this function:
SetAttributes[hideEchoEvaluation, HoldFirst];
hideEchoEvaluation[expr_] := WithCleanup[MakeBoxes[EchoEvaluation[arg_, ___], form_] := MakeBoxes[arg, form], expr, MakeBoxes[EchoEvaluation[arg_, ___], form_]=.]EchoEvaluation does not appear in the printed expressions:
EchoEvaluation[Accumulate[EchoEvaluation[Reverse[EchoEvaluation[Range[10]]]]]]//hideEchoEvaluationProperties & Relations (5)
EchoEvaluation returns the expression in its first argument:
EchoEvaluation[expr]EchoEvaluation prints the expression before and after evaluation:
EchoEvaluation[1 + 1]Echo only prints the expression after evaluation:
Echo[1 + 1]EchoEvaluation uses the same label before and after evaluation:
EchoEvaluation[StringSplit["This is a sentence"], "words:"]Specify different labels for before and after evaluation:
EchoEvaluation[StringSplit["This is a sentence"], "sentence:" -> "words:"]EchoEvaluation[expr,label,f] uses f to print the result after evaluation:
EchoEvaluation[1 + 1, "sum:", Hold]In EchoEvaluation[expr,label,gf], the function g is given the unevaluated expression and f is given the evaluated expression:
EchoEvaluation[1 + 1, "sum:", Hold -> HoldComplete]EchoEvaluation[expr,label] is effectively equivalent to EchoEvaluation[expr,label,UnevaluatedIdentity]:
EchoEvaluation[Print["Hello"], label]EchoEvaluation[Print["Hello"], label, Unevaluated -> Identity]Possible Issues (1)
In EchoEvaluation[expr,label,gf], the function g must have a holding attribute like HoldFirst or expr will be evaluated twice:
x = 0;EchoEvaluation[x++, "increment:", Panel -> Identity];Since Panel does not hold its arguments, the symbol x has been incremented twice:
xSee Also
Echo EchoTiming QuietEcho EchoFunction EchoLabel TracePrint In Out
Related Guides
History
Text
Wolfram Research (2020), EchoEvaluation, Wolfram Language function, https://reference.wolfram.com/language/ref/EchoEvaluation.html.
CMS
Wolfram Language. 2020. "EchoEvaluation." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/EchoEvaluation.html.
APA
Wolfram Language. (2020). EchoEvaluation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EchoEvaluation.html
BibTeX
@misc{reference.wolfram_2026_echoevaluation, author="Wolfram Research", title="{EchoEvaluation}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/EchoEvaluation.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_echoevaluation, organization={Wolfram Research}, title={EchoEvaluation}, year={2020}, url={https://reference.wolfram.com/language/ref/EchoEvaluation.html}, note=[Accessed: 13-June-2026]}