Skip to content

Do

Do[expr, n] evaluates expr n times.

Table[expr, {sym, n}] evaluates expr with sym = 1 to n.

Table[expr, {sym, m, n}] evaluates expr with sym = m to n.

Attributes[Do] := {HoldAll, Protected}

Simple examples

In[1]:= Catch[CompoundExpression[Do[If[(a) > (6), Throw[a]], {a, 10}], False]]
Out[1]= 7