Tam Do - 2007-05-27

Hi Hugh,

Thanks for all your help so far. I have another request for you, ELSE IF statements.

The syntax i'm thinking of them is:

TestCondition = 1
IF TestCondition = 0 THEN
NOP
ELSE IF TestCondition = 1 THEN
NOP
END IF

I know this is very similar to a case statement but there are more things I believe you can do with an ELSE IF statement than a case statement, like comparision of multiple variables, or checking of different conditions on each ELSE if statement with respect to different variables.

Now to implement this in your compiler I'm thinking it would work as follows.

Scan the IF statement until END IF is reached.
Label where END IF is located and jump to it whenever the end of the IF statement is reached.
Label where each ELSE IF statement is located.
If the condition fails for the first IF statement jump to the next ELSE IF statement.
If the last else if statement condition fails then it should jump to the end of the block.

Thanks!!