I repeat: The FIRST variant is OK, compiles OK, and runs Ok.
What do you mean by "confused the compiler"? (i.e. syntax error?)
Also, the second variant is ok, but you're mixing block IF sentences with single-line IF sentences and is confusing. You can write it as:
Which looks clearer.
ELSEIF is like SWITCH in other languages like C/C++. Once a condition is fulfilled, the remaining ones are skipped which leads to faster execution.
What do you mean by "confused the compiler"? (i.e. syntax error?)
Also, the second variant is ok, but you're mixing block IF sentences with single-line IF sentences and is confusing. You can write it as:
Code:
IF X = 1 THEN
X = 2
ELSEIF X = 2 THEN
IF T < 10 THEN X = 3
END IF
Which looks clearer.
ELSEIF is like SWITCH in other languages like C/C++. Once a condition is fulfilled, the remaining ones are skipped which leads to faster execution.