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

Home » Public Forums » archive » Re: Empty FOREACH loop
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: Empty FOREACH loop [message #81734 is a reply to message #75101] Fri, 12 October 2012 14:33 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
> On 2/14/11 8:08 pm, Paulo Penteado wrote:
>>
>> I also get the temporary variables stuff, and agree that things like
>>
>> foreach el,!null do print,el
>> foreach el,[] do print,el
>> foreach el,{} do print,el
>>
>> Should all do nothing, with no errors.
>>
>> But if foreach is given a named variable that is !null it does nothing
>> as expected:
>>
>> IDL> n=!null
>> IDL> foreach el,n do print,el

Those examples are good, but today I realize I'd really like this to work (quietly do no iterations) if I use an undefined variable (such as an unfilled keyword variable):

IDL> foreach x, myUndefinedNonVariable do print,x
% Variable is undefined: MYUNDEFINEDNONVARIABLE.
% Execution halted at: $MAIN$

Would anyone else agree that with no elements in myUndefinedNonVariable, this should quietly do no iterations?

Cheers,
-Dick
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: dialog_pickfile crashing IDLDE
Next Topic: Pointer and structure question

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

Current Time: Fri Oct 10 17:44:15 PDT 2025

Total time taken to generate the page: 1.19981 seconds