WLJS LogoWLJS Notebook

Scan

Scan[f, expr] evaluates f applied to each element of expr in turn (for side effects).

Scan[f, expr, levelspec] applies f to parts at specified levels.

Examples

Print each element:

Scan[Print, {a, b, c}]
(* prints: a, b, c *)

Accumulate values with side effects:

total = 0;
Scan[(total += #) &, {1, 2, 3, 4}];
total
(* 10 *)

Please visit the official Wolfram Language Reference for more details.

On this page