Chapter 2 If-Else-or-etc.
This is the heart of control flow. Without it, you cannot do
dittly except for the gratutious hi mobile, and pickup mobile.
In place of any legal mud command in a MOBprogram, one can substitute a
flow of control command. Here is the syntax for a flow of control command.
"if" " " "(" ")" NL
or ( ) NL
. . .
or ( ) NL
NL
NL
. . .
break NL
. . .
NL
else NL
NL
NL
. . .
break NL
. . .
NL
"endif" NL
Basically, it is: an 'if' line, followed by zero or more 'or' lines,
followed by zero or more legal mud commands, which may contain a 'break' line,
possibly followed by an 'else' line , followed by zero or more legal mud
commands, which may contain a 'break' line, followed by an 'endif' line.
The only new syntax labels are all in the IF line:
--Explainations
An IF_CHECK is a string which describes under what context to compare things.
The ARGUMENT is the reference point from which the LHS of an expression comes.
The OPERATOR indicates how the LHS and RHS are going to be compared.
The VALUE is the RHS of the expression to be compared by the operator.
The BREAK command bails out of the entire MOBprogram regardless of the
level if nesting.
If that looks confusing, skip to the end of the document and review the
Example. Hopefully that should clear things, otherwise you'll probably have
to give us a mail since examples are the best way we know to explain syntax.
Anything between " " is required. Otherwise, it's pretty much
optional.
|