Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Why no error message?

May
12,834
163
Why doesn't the second command below produce an error message?
Code:
v:\> echo %zzzz
ECHO is OFF

v:\> if %zzzz LT 0 echo yes
yes

v:\> if LT 0 echo yes
Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command
 
The IF %zzzz variable isn't expanded until the IF command runs. So it is *not* equivalent to "if LT 0"; it's equivalent to "IF (empty arg) LT 0".
I see that now. It's the same for IFF (and different for @IF). A long time ago I got into the habit of quoting (or somehow prefixing/postfixing the args to binary operators). Without thinking much about it lately, I figured that was in case they were empty. But empty isn't mush of a problem. Hmmm!
 

Similar threads

Back
Top