MathGroup Archive 2008

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

Search the Archive

Re: Instructions in for


Hello Alejandra,

On Sat, Jun 7, 2008 at 2:59 AM, Alejandra Lozada <alozih at gmail.com>
> QUESTION: how to introduce many instructions in for?
Here is an example that shows the use of semicolons.

For[ i=1, i<20, i++,
Print[i];
 Print[i^2];
 d= FactorInteger[i];
 Print[Length[d]]
 ]


Generally, you will get more flexible and faster code if you use Map,
Table, and Through type constructs rather than For.


-- 
W. Craig Carter


  • Prev by Date: Re: ContourPlot3D appearance
  • Next by Date: Re: Major problem with 6.0.2.1
  • Previous by thread: Instructions in for
  • Next by thread: Re: Instructions in for