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

Home » Public Forums » archive » AND statements
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: AND statements [message #14577 is a reply to message #14504] Sat, 06 March 1999 00:00 Go to previous messageGo to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <O0s$q03Z#GA.227@nih2naae.prod2.compuserve.com>
"Steve Scheele" <sscheele@scitor.com> writes:

> I wrote the previous message late at night - it really wasn't what I was
> thinking. I think that compound AND statements can be concisely written as;
>
> If Not (A EQ 0) Then If B/A GT 5 Then . . .
>
> Formed in this manner, the second part will not be evaluated is the first
> part is false.

True. The "problem" is when you want to write this up into
a short and concise test with an ELSE part, you'll have to
repeat the ELSE branch:

IF NOT (A EQ 0) THEN IF B/A GT 5 THEN <SOMETHING> $
ELSE <SOMETHING_ELSE> $
ELSE <SOMETHING_ELSE>

(Where the second SOMETHING_ELSE is the same as the first one)

The ?: construct gives a more compact notation:

IF ((A EQ 0) ? 0b : B/A GT 5) THEN <SOMETHING> $
ELSE <SOMETHING_ELSE>

Personally, though, I don't like using the ?: construct
for anything but assignments, since it tends to clutter
up more complex statements..

> The problem that I have is with the OR statement. Something
> like
>
> If A EQ 0 OR B/A GT 5
>
> will blow up on A=0
>
> I haven't really figured out a good way to implement this type of OR
> statement.

IF (A EQ 0) ? 1b : B/A GT 5 THEN ...

But again, this isn't very readable...

Stein Vidar
[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: Drag-Drop Possible in IDL5.2 ??
Next Topic: Re: XResources and menu mnemonics

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

Current Time: Sun Oct 12 11:22:43 PDT 2025

Total time taken to generate the page: 0.80343 seconds