Qbasicnews.com

Full Version: logical operators Q
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
EQV and IMP are also correct.

Aga,
why do you use
Code:
IF ... THEN

ELSE
  IF ... THEN

  END IF
END IF
rather than the shorter form
Code:
IF ... THEN

ELSEIF ... THEN

END IF
It is not that it really matters. I assume they execute the same, but your method requires one more END IF that you could forget.
Quote:That's right........

................
Yeah, as I said, I was thinking in prolog Tongue
Quote:Yeah, as I said, I was thinking in prolog

Yeah, defintely too much pot. Next thing you'll be programming in Prolog :o.

Aga, whats all this for anyway?
Another useless utility:

a converter to IF... THEN form, since it's more efficient..
Quote:Another useless utility:

a converter to IF... THEN form, since it's more efficient..

Is that because if you do this:

Code:
IF a = 1 AND b = 1

Even is a = 5, it will still test the b = 1 expression? That shouldn't be much of a difference at all, but eiether way, you couldn't get around it with OR, XOR, NOT, EQV, and probably IMP, but I don't know what that is.
Quote:Even is a = 5, it will still test the b = 1 expression?

Yes, and there is a BIG difference. Try just one A OR B: it's twice as fast when the OR isn't there.
Quote:
Quote:Even is a = 5, it will still test the b = 1 expression?

Yes, and there is a BIG difference. Try just one A OR B: it's twice as fast when the OR isn't there.

That really sucks that QB doesn't even try to optimize at all.

However, you could only get around it with AND.
It is very frustrating to learn every now and then that QB's compiler doesnt optimize anything =(
AND is also inefficient. It checks each truth value and doesn't exit out once a FALSE is reached.
=O were m$ developers brain dead or something while developing QB?
Pages: 1 2 3