I have looked through previous posts and they do not satisfy my question.
The following seems to work just fine, but is it "legal"?
I can't find a reference to nesting IF statgements in this manner and want to be cautious...
Remark>Pare MIT line down to fit 9 chars
If>MITCNTLG=4
Let>Let>MITLN=00090%MITCNT%%SPRFILE%
ELSE
If>MITCNTLG=3
Let>MITLN=000900%MITCNT%%SPRFILE%
Else
If>MITCNTLG=2
Let>MITLN=0009000%MITCNT%%SPRFILE%
ENDIF
Nested If> Loops
Moderators: Dorian (MJT support), JRL
- tony_smith
- Pro Scripter
- Posts: 70
- Joined: Wed May 14, 2003 8:25 pm
- Location: Vancouver BC Canada
JRL is correct. Your script is invalid as there are not enough EndIfs. Each If must have an Endif.
Perhaps you meant:
Remark>Pare MIT line down to fit 9 chars
If>MITCNTLG=4
Let>MITLN=00090%MITCNT%%SPRFILE%
Else
If>MITCNTLG=3
Let>MITLN=000900%MITCNT%%SPRFILE%
Else
If>MITCNTLG=2
Let>MITLN=0009000%MITCNT%%SPRFILE%
EndIf
EndIf
EndIf
Although this would also work in this case:
Remark>Pare MIT line down to fit 9 chars
If>MITCNTLG=4
Let>MITLN=00090%MITCNT%%SPRFILE%
EndIf
If>MITCNTLG=3
Let>MITLN=000900%MITCNT%%SPRFILE%
EndIf
If>MITCNTLG=2
Let>MITLN=0009000%MITCNT%%SPRFILE%
EndIf
No real need for elses here since if MITCNTLG=4 it can't be 3 or 2, so each bit can be sequential.
Both versions above are valid.
Perhaps you meant:
Remark>Pare MIT line down to fit 9 chars
If>MITCNTLG=4
Let>MITLN=00090%MITCNT%%SPRFILE%
Else
If>MITCNTLG=3
Let>MITLN=000900%MITCNT%%SPRFILE%
Else
If>MITCNTLG=2
Let>MITLN=0009000%MITCNT%%SPRFILE%
EndIf
EndIf
EndIf
Although this would also work in this case:
Remark>Pare MIT line down to fit 9 chars
If>MITCNTLG=4
Let>MITLN=00090%MITCNT%%SPRFILE%
EndIf
If>MITCNTLG=3
Let>MITLN=000900%MITCNT%%SPRFILE%
EndIf
If>MITCNTLG=2
Let>MITLN=0009000%MITCNT%%SPRFILE%
EndIf
No real need for elses here since if MITCNTLG=4 it can't be 3 or 2, so each bit can be sequential.
Both versions above are valid.
MJT Net Support
[email protected]
[email protected]
- tony_smith
- Pro Scripter
- Posts: 70
- Joined: Wed May 14, 2003 8:25 pm
- Location: Vancouver BC Canada
Thanks to all who responded... lots of ideas and guidance.
It is feedback like this that shows the value of these forums, something I wish other mission-critical software would have.
The lack of endifs is a rookie mistake on my part... oops! My trial values did not test all the loops.
Also, I made a typo by duplicating the let command;
Let>Let>MITLN=00090%MITCNT%%SPRFILE%
It is feedback like this that shows the value of these forums, something I wish other mission-critical software would have.
The lack of endifs is a rookie mistake on my part... oops! My trial values did not test all the loops.
Also, I made a typo by duplicating the let command;
Let>Let>MITLN=00090%MITCNT%%SPRFILE%