Welcome!

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

SignUp Now!

if and text: bug or feature?

This
iff cond then
text
...
endtext
endiff

works as expected.
But this
if cond text
...
endtext

works fine if the condition is true. If it is false, then things go haywire and as far as I can tell subsequent batch lines are swallowed (not executed) until a return (this was in a subroutine).
 
> This
> iff cond then
> text
> ...
> endtext
> endiff
> works as expected.
> But this
> if cond text
> ...
> endtext
> works fine if the condition is true. If it is false, then things go
> haywire and as far as I can tell subsequent batch lines are swallowed (not
> executed) until a return (this was in a subroutine).

WAD - and you *really* wouldn't want it to work any other way.

If an IF condition fails, IF will not execute the command, so the parser has
no way to know that you're trying to use a TEXT / ENDTEXT. The only way it
could know that would be to expand and execute the command in every
instance, which would render the IF moot! :-)

Bottom line - never, never, put a TEXT / ENDTEXT in an IF statement.

Rex Conn
JP Software
 
You may want to add a warning to the documentation of IF. I figured out what was going on but it took a while. Once I understood, I also had a good idea of what your response would be ;) too.

It just bugs me if there are exceptions to general rules (in my old age strike that... mature years I have trouble remembering them) and especially undocumented ones.
 

Similar threads

Back
Top