IF ELSEIF END

From 4Dimensions
Jump to: navigation, search

IF ELSEIF END

IF ELSEIF END

IF ELSEIF END

IF ELSEIF END


Usage: if (expression)

...

elseif (expression)

...

else

...

end

if (if %actor.vnum% == -1)

%echo% You are a player

else

%echo% You are a mob.

end


An 'if' must occur before the other three. If expression evaluates to true

({cRHELP EXPRESSIONS{c0), the statements between the if statement and the next

elseif, else, or end are executed. If it stopped at an elseif or else, it scans

for the next end, and continues execution at that point. If the expression

evaluated to false, it searches for the next elseif, else, or end. If it finds

an elseif, it checks that expression. If it is true, it executes the statements

between the elseif and the next elseif, else, or end, and then finds the end of

the block. If it is false, it continues searching in the same pattern, until a

true elseif is found, an else is found, or an end is found. There may be 0 or

1 else statements and 0 or many elseif statements in the block.


For anyone having trouble with the format of if/elseif/else/end blocks

{cRTSTAT 22{c0. Relsqui made this excellent example.


      • EVERY IF NEEDS AN END: 2 IF'S NEEDS 2 ENDS....***


See Also: EXPRESSIONS NESTED