I find myself stuck with this syntax. using the .if .elseif .else and .endif

Could the statements be nested within each other like below or would I have to put
the else or elseif statements after the last if statement. Just an idea thats not working maybe my syntax isn't correct. Thanxs in advance :D


.if smthing==eax
.elseif smthing==eax
.if smthing2==eax
mov smthing, ecx
.elseif smthing2==eax
mov smthing2, ecx
.endif
.endif
.endif
.endif
Posted on 2003-07-26 19:00:51 by Tweak
IF the condition of the .IF statement is met the .ELSEIF statement is not executed. So if you have this:
.IF something == 2

mov something,1
.ELSEIF something == 1
mov something,2
.ENDIF

the fact that you made something equal to 1 just before the .ESLEIF has no effect on the conditions because if something was equal to 2 then the .ESLEIF was never executed. To help with the logic of your flow better indenting is needed, each endif must have a corresponding if statement, your conditional is unbalanced...
.if smthing==eax

.elseif smthing==eax
.if smthing2==eax
mov smthing, ecx
.elseif smthing2==eax
mov smthing2, ecx
.endif
.endif
.endif <<<- unused endif (no opening .IF statement)
.endif <<<- unused endif (no opening .IF statement)
Posted on 2003-07-26 19:14:57 by donkey