MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re:Doloop

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16623] Re: [mg16530] Re:Doloop
  • From: Jason Gill <jgill at vbimail.champlain.edu>
  • Date: Fri, 19 Mar 1999 12:53:49 -0500
  • Organization: IBM Microelectronics
  • References: <199903160900.EAA09432@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Samir,
    The Format for a Do Loop is as follows,
Do[
        command1;
        command2;
        commandN,
        {i,1,n}]
The key is that you need a comma, before your iterator sequence.
For Example
In[85]:=
Do[Print[i],{i,1,5}]
1
2
3
4
5

I'm not sure what your application is, however, in  many cases
Mathematica has built in functions like Map  or some version of it.
MapThread,MapIndexed, etc.   which can be implemented much more
effectivley.
Jason

Samir Al-Mulla wrote:

> I want to ask where to put the Return command to the Doloop , for
> example :
>
> Do k=1 to 20
> f1=...
> f2=....
>
> Return
>
> How  we do that in Mathematica?
>
> Many thanks
> MVH
> Samir





  • References:
    • Re:Doloop
      • From: "Samir Al-Mulla" <SAA@adm.ing.hb.se>
  • Prev by Date: Re: "Solve[x==Erf[x], x]"
  • Next by Date: Re: unbelievable ...
  • Previous by thread: Re:Doloop
  • Next by thread: Re: Algorithms to calculate square root (correction)