MathGroup Archive 2008

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

Search the Archive

Re: Instructions in for


  Hello, Alejandra,

    Try using semicolons between the separate instructions you'd like to
include in the For loop.

     In your example:

    For[ i=1, i<n, i++, Print[i]; Print[i^2]; Print@Plot[Sin[3i+2x], {x,
0, 6}] ]


> Hello Group,
>
> ______________________________________________
> QUESTION: how to introduce many instructions in for?
> ______________________________________________
>
>
> In C++ it is possible to use while/for and
> include many instructions:
>
> for( i=0; i<n; i++ ){
>     instructions,
>     as many as you
>     like }
>
> In Mathematica, one instruction (Print)  :
>
> For[ i=1, i<n, i++, Print[i] ]
> how can I include more instructions?
>
> Thank you All,
> Alejandra L.
>
>
>



  • Prev by Date: color depth of eps export
  • Next by Date: Re: Instructions in for
  • Previous by thread: Re: Instructions in for
  • Next by thread: Re: Instructions in for