Mathematica 9 is now available

Do

Do[expr, {imax}] evaluates expr imax times.
Do[expr, {i, imax}] evaluates expr with the variable i successively taking on the values 1 through imax (in steps of 1).
Do[expr, {i, imin, imax}] starts with i = imin.
Do[expr, {i, imin, imax, di}] uses steps di.
Do[expr, {i, imin, imax}, {j, jmin, jmax}, ... ] evaluates expr looping over different values of j, etc., for each i.

• See also: For, Table, While.

Examples

Using InstantCalculators

Here are the InstantCalculators for the Do function. Enter the parameters for your calculation and click Calculate to see the result.

Entering Commands Directly

You can paste a template for this command via the Text Input button on the Do Function Controller.

Here is a Do loop that adds the first 1000 integers.

Clear the variable definition.



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.