- Jul
- 534
- 10
If you compare string values with ne/eq instead of !=/== as part of an iff, TCC "forgets" that it’s in an iff, and give an error when it hits the endiff.
Which is informative in that it tells me something is clearly wrong. So I found my error. Using eq instead of ==
But still, I found it curious that the same thing in "if" doesn’t give any kind of error.
I’m going to venture a guess: This is because if copies CMD.exe behavior, but iff is it’s own TCC-specific thing?
Discovered via playing around to try to troubleshoot a separate issue...
Which is informative in that it tells me something is clearly wrong. So I found my error. Using eq instead of ==
But still, I found it curious that the same thing in "if" doesn’t give any kind of error.
I’m going to venture a guess: This is because if copies CMD.exe behavior, but iff is it’s own TCC-specific thing?
Discovered via playing around to try to troubleshoot a separate issue...
Code:
@Echo OFF
echo %%* is %*
echo %%1$ is %1$
echo %%1 is %1
iff "%1" == "" then
echo iff eq says it **IS** empty
endiff
iff "%1" == "" then
echo iff ne says it is NOT empty
endiff
rem No errors yet!
if "%1" eq "" (echo if eq says it **IS** empty)
if "%1" ne "" (echo if ne says it is NOT empty)
rem Still no errors!
rem but NOW there will be errors:
iff "%1" eq "" then
echo iff eq says it **IS** empty
endiff
iff "%1" ne "" then
echo iff ne says it is NOT empty
endiff
echo END