Echo

Echo[expr]

prints expr and returns expr.

Echo[expr,label]

prints expr prepending label and returns expr.

Echo[expr,label,f]

prints f[expr] prepending label and returns expr.

Examples

open allclose all

Basic Examples  (3)

Print the result of an intermediate computation:

Print an intermediate result using a label:

Report a property of an intermediate result:

Scope  (4)

Echo[] can be used as an argument to other functions because Echo returns its first argument:

Mix Echo and Print statements:

Use Echo with any type of expression:

Use Echo with Unevaluated expressions:

Applications  (2)

Observe the order in which Cases visits parts of an expression at level 1:

At all levels:

Report timings of intermediate evaluations:

Properties & Relations  (2)

Echo returns the expression in its first argument:

Print returns Null:

The operator form of Echo is EchoFunction:

Echo gives priority to the label and EchoFunction to the function:

These cases are equivalent:

Introduced in 2015
 (10.3)