Skip to main content
added 425 characters in body
Source Link

Defining a function with some side-effect for demonstration purposes.

f[i_, j_] := Echo[{i, j}]

Here are some more WL-esque options:

Array[f, {2, 3}];
Outer[f, Range[2], Range[3], 1];
f @@@ Tuples[{Range[2], Range[3]}];

Note the ; above to suppress the output. If your function indeed only has side-effects and you don't want the output (supposedly that's why you chose Do instead of Table), you can also use Scan:

Scan[Echo, Tuples[{Range[2], Range[3]}]]

Defining a function with some side-effect for demonstration purposes.

f[i_, j_] := Echo[{i, j}]

Here are some more WL-esque options:

Outer[f, Range[2], Range[3], 1];
f @@@ Tuples[{Range[2], Range[3]}];

Defining a function with some side-effect for demonstration purposes.

f[i_, j_] := Echo[{i, j}]

Here are some more WL-esque options:

Array[f, {2, 3}];
Outer[f, Range[2], Range[3], 1];
f @@@ Tuples[{Range[2], Range[3]}];

Note the ; above to suppress the output. If your function indeed only has side-effects and you don't want the output (supposedly that's why you chose Do instead of Table), you can also use Scan:

Scan[Echo, Tuples[{Range[2], Range[3]}]]
Source Link

Defining a function with some side-effect for demonstration purposes.

f[i_, j_] := Echo[{i, j}]

Here are some more WL-esque options:

Outer[f, Range[2], Range[3], 1];
f @@@ Tuples[{Range[2], Range[3]}];