Post Reply 
Checking conditions [IF ... THEN ... ELSE] performance
09-15-2015, 05:04 AM
Post: #7
RE: Checking conditions [IF ... THEN ... ELSE] performance
(09-14-2015 09:01 PM)komame Wrote:  Generaly each condition has two parts: before the operator and after the operator.

In the case of the OR operator the first part is always checked and if it returns True the second part should be skipped.
In the case of the AND operator the first part is always checked and if it returns False the second part should be skipped. ...

I believe that all programming languages are working that way.

UBASIC both does and doesn't! It has two allowed syntaxes, infix and prefix, and they work differently:

Infix: A and B --> both expressions always get evaluated.

Prefix: and(A,B,C,...) --> evaluating from left to right, as soon as one of the arguments evaluates to 0, all subsequent arguments are skipped (unevaluated) and 0 is returned immediately.

Unfortunately HP-71 BASIC's "and" operator only has infix notation, and it always evaluates both expressions.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Checking conditions [IF ... THEN ... ELSE] performance - Joe Horn - 09-15-2015 05:04 AM



User(s) browsing this thread: 1 Guest(s)