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

Home » Public Forums » archive » Re: while loop crashes
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: while loop crashes [message #71150 is a reply to message #71147] Tue, 01 June 2010 03:27 Go to previous messageGo to previous message
lila hadji is currently offline  lila hadji
Messages: 7
Registered: June 2010
Junior Member
On 1 juin, 12:18, Spon <christoph.b...@gmail.com> wrote:
> On Jun 1, 8:51 am, hovru <h.rube...@gmail.com> wrote:
>
>> Wouldn't you not need the "Pro" and "End" if it's not a program, just
>> a script (such as when you use "Journal")?
>> Also, leaving out the "return" should be fine, since there is only one
>> level, right?
>
>> Thanks.
>
> Looks like you can't have loops or statements in batch files; every
> statement has to be complete, just like if you were using the command
> line.
>
> So, this works fine, but your program does not:
> ---
> print, 'start while loop'
>         j=2
> while (j NE 10) do j=j+1
>
> print, 'done', j
> ---
>
> Have a look at the helpfile for 'Executing Batch Jobs in IDL', I
> guess.
> I've always wondered why people even use batch mode, when procedures
> and functions are almost as easy to write.  What is the advantage of
> batch mode?
>
> No, you don't need the 'return', but what harm is it doing?  Plus, if
> you decide to modify the code to pass variables or keywords to it
> later, you might wonder why they never come back. :-)
>
> Chris
Actually, when you want to run a script, you can remose the pro line,
and add (optionally) $Main$ at the beginning (to speed up the
performances)
You can also remove the return line but you have absolutely to keep
the end line.
; files simpletest.pro
$Main$
print, 'start while loop'
j=2
while (j NE 10) do begin
print,j
j=j+1
print, j
endwhile

print, 'done'
end


and all you have to do in IDL screen is tape .run simpletest.pro
Hope it helps a little
Cheers
Lila
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How to set the multiple xaxis labels
Next Topic: A Contour Tracking Problem

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

Current Time: Wed Oct 08 15:56:30 PDT 2025

Total time taken to generate the page: 0.00433 seconds