- Jun
- 762
- 16
I expected that the IF and IFF commands would properly interpret the values 0 and 1 to be FALSE and TRUE, respectively. When I tested it with IFF, it worked.
So I could not understand why my code that used IF was failing with error messages -- until I tried the same simple cases.
With IFF, I can use code like this:
or
but similar commands with IF do not work.
TCC(30.00.18): C:\>iff 0 then echo TRUE & else & echo FALSE & endiff
FALSE
TCC(30.00.18): C:\>iff 1 then echo TRUE & else & echo FALSE & endiff
TRUE
So I could not understand why my code that used IF was failing with error messages -- until I tried the same simple cases.
TCC(30.00.18): C:\>if 0 echo FALSE
Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command
TCC(30.00.18): C:\>if 1 echo TRUE
Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command
With IFF, I can use code like this:
IFF %@REGEX[...] THEN
or
IFF %@LENGTH[...]
but similar commands with IF do not work.