Re: idl6.2 and if statemente [message #45890] |
Sun, 09 October 2005 01:07  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Craig Markwardt wrote:
> Reimar Bauer <R.Bauer@fz-juelich.de> writes:
>
>
>> Dear all
>>
>> probably I am confused from some of the other languages I used in the
>> last days.
>>
>> text is a vector of length two
>>
>> IF N_ELEMENTS(text) then dummy=TEMPORARY(text)
>>
>> does not give true till I changed it to
>>
>> IF N_ELEMENTS(text) gt 0 then dummy=TEMPORARY(text)
>>
>>
>> Is there something changed in this behaviour I was sure the first one
>> will work.
>
> Reimar,
>
> IDL has always defined the odd integers as true and the even integers as
> false. Since IDL version 4 at least.
>
> Craig
>
You are right, I do remember. It is always better to write out the complete
logic.
Reimar
|
|
|
Re: idl6.2 and if statemente [message #45891 is a reply to message #45890] |
Sun, 09 October 2005 01:07  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Paul Selby wrote:
> Craig Markwardt wrote:
>
>> Reimar Bauer <R.Bauer@fz-juelich.de> writes:
>>
>>
>>> Dear all
>>>
>>> probably I am confused from some of the other languages I used in the
>>> last days.
>>>
>>> text is a vector of length two
>>>
>>> IF N_ELEMENTS(text) then dummy=TEMPORARY(text)
>>>
>>> does not give true till I changed it to
>>>
>>> IF N_ELEMENTS(text) gt 0 then dummy=TEMPORARY(text)
>>>
>>>
>>> Is there something changed in this behaviour I was sure the first one
>>> will work.
>>
>> Reimar,
>>
>> IDL has always defined the odd integers as true and the even integers as
>> false. Since IDL version 4 at least.
>>
>> Craig
>>
>
> Since IDL 6.0 you can force all non-zero values to be treated as true
> using
>
> compile_opt LOGICAL_PREDICATE
>
>
> Paul
Thanks
cheers
Reimar
|
|
|
Re: idl6.2 and if statemente [message #45892 is a reply to message #45890] |
Sat, 08 October 2005 18:09  |
Paul Selby
Messages: 5 Registered: August 2003
|
Junior Member |
|
|
Craig Markwardt wrote:
> Reimar Bauer <R.Bauer@fz-juelich.de> writes:
>
>
>> Dear all
>>
>> probably I am confused from some of the other languages I used in the
>> last days.
>>
>> text is a vector of length two
>>
>> IF N_ELEMENTS(text) then dummy=TEMPORARY(text)
>>
>> does not give true till I changed it to
>>
>> IF N_ELEMENTS(text) gt 0 then dummy=TEMPORARY(text)
>>
>>
>> Is there something changed in this behaviour I was sure the first one
>> will work.
>
> Reimar,
>
> IDL has always defined the odd integers as true and the even integers as
> false. Since IDL version 4 at least.
>
> Craig
>
Since IDL 6.0 you can force all non-zero values to be treated as true using
compile_opt LOGICAL_PREDICATE
Paul
|
|
|
Re: idl6.2 and if statemente [message #45893 is a reply to message #45892] |
Sat, 08 October 2005 14:37  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Reimar Bauer <R.Bauer@fz-juelich.de> writes:
> Dear all
>
> probably I am confused from some of the other languages I used in the last
> days.
>
> text is a vector of length two
>
> IF N_ELEMENTS(text) then dummy=TEMPORARY(text)
>
> does not give true till I changed it to
>
> IF N_ELEMENTS(text) gt 0 then dummy=TEMPORARY(text)
>
>
> Is there something changed in this behaviour I was sure the first one will
> work.
Reimar,
IDL has always defined the odd integers as true and the even integers as
false. Since IDL version 4 at least.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|