Legacy Documentation

Mathematica CalcCenter 2 (2002)

This is documentation for an obsolete product.
Current products and services

Documentation / CalculationCenter / Functions / Defining Functions / Iterators /

Do

FilledSmallSquare Do[expr, {imax}] evaluates expr imax times.

FilledSmallSquare Do[expr, {i, imax}] evaluates expr with the variable i successively taking on the values 1 through imax (in steps of 1).

FilledSmallSquare Do[expr, {i, imin, imax}] starts with i = imin.

FilledSmallSquare Do[expr, {i, imin, imax, di}] uses steps di.

FilledSmallSquare Do[expr, {i, imin, imax}, {j, jmin, jmax}, ... ] evaluates expr looping over different values of j, etc., for each i.

FilledSmallSquare 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.

In[1]:=

In[2]:=

In[3]:=

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.

In[4]:=

In[5]:=

In[6]:=

Out[6]=

Clear the variable definition.

In[7]:=



ja