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

Home » Public Forums » archive » A simple IF statement question
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: A simple IF statement question [message #42522 is a reply to message #42513] Mon, 14 February 2005 06:49 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Andry William writes:

> I am using IDL 6.1 on Linux SUSE. I am writing a simple code using the
> IF statement and am wondering about the following result:
>
> IDL> IF 1 THEN PRINT, '1' ELSE PRINT, 'None'
> 1
> IDL> IF 2 THEN PRINT, '2' ELSE PRINT, 'None'
> None
> IDL> IF 19 THEN PRINT, '19' ELSE PRINT, 'None'
> 19
> IDL> IF 24 THEN PRINT, '24' ELSE PRINT, 'None'
> None
> IDL> IF 0 THEN PRINT, '0' ELSE PRINT, 'None'
> None
>
> Am I wrong when I expect the IF statement to return always TRUE if the
> condition is not 0 (I mean something like 1,2,3,4,....)?

Yes, you are wrong. :-)

Here is an article you might want to read:

http://www.dfanning.com/code_tips/bitwiselogical.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: test
Next Topic: strange things in CONTOUR

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

Current Time: Sun Oct 12 12:34:38 PDT 2025

Total time taken to generate the page: 0.39134 seconds