MathGroup Archive 2008

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

Search the Archive

Re: Instructions in for

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89387] Re: [mg89371] Instructions in for
  • From: "Curtis F. Osterhoudt" <cfo at lanl.gov>
  • Date: Sun, 8 Jun 2008 02:30:57 -0400 (EDT)
  • References: <200806070659.CAA09938@smc.vnet.net>
  • Reply-to: cfo at lanl.gov

  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