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 #71130 is a reply to message #71129] Wed, 02 June 2010 01:48 Go to previous messageGo to previous message
hovru is currently offline  hovru
Messages: 3
Registered: June 2010
Junior Member
On Jun 1, 3:27 am, lila hadji <lhad...@gmail.com> wrote:
> 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

It seems awkward, but it makes sense.
Thanks for all the help.
[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:48:40 PDT 2025

Total time taken to generate the page: 0.00452 seconds