comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » FOR loops and efficiency
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: For loop [message #68430 is a reply to message #66568] Mon, 26 October 2009 08:01 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Oct 26, 11:54 am, Hassan <hkhav...@gmail.com> wrote:
> Hi,
>
> I wonder if I can use 'For... Do Begin....End For ' in the command
> line. I can use this in a pro code and it works well but in command
> line it gives me errors. I just can use 'For... Do' in command line
> but it's not suitable if I have several commands into the loop. Could
> you pleasse help me about that.
>
> Cheers,
> Hassan.

In the command line (as well as in a batch file), you need to provide
the entire loop "in one line". That is, you need to use & to put all
the lines of your loop into one, as in:

for i=0,1 do begin & print,i & print,i & endfor

But that is only proper for something short, like two or three short
statements in the loop. Do not abuse it. If you need to write a long
block it should not be done in this way, it should be in a function or
procedure.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: surface_polar plot
Next Topic: Re: Using FFT convolve() : centering error?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:57:27 PDT 2025

Total time taken to generate the page: 0.00199 seconds