XMREngine.advflowctl
From Dreamnation
Revision as of 14:46, 3 February 2015 by Admin (Talk | contribs) (Created page with "Provide advanced flow-control statements similar to other programming languages. Enabled by: xmroption advflowctl; Keywords: break case constant continue...")
Provide advanced flow-control statements similar to other programming languages.
Enabled by: xmroption advflowctl;
Keywords:
break case constant continue switch ... : &&& |||
'break' : valid in 'do', 'for', 'foreach', 'switch', 'while' 'continue' : valid in 'do', 'for', 'foreach', 'while'
'&&&' : provides short-circuiting AND operation
left-hand operand evaluated before right-hand operand right-hand operand evaluated only if left-hand operand is true
'|||' : provides short-circuiting OR operation
left-hand operand evaluated before right-hand operand right-hand operand evaluated only if left-hand operand is false
'constant' usage as follows:
'constant' name '=' constantexpr ';'
constantexpr := floatconstant | integerconstant | stringconstant | constantexpr constbinop constantexpr | constunop constantexpr constbinop := '+' | '-' | '*' | '/' | '%' | '&' | '|' | '^' constunop := '-' | '~'
name is defined to be the same type as constantexpr
Note: & | ^ ~ require all integer operands - * / % require either integer or float operands only + is valid for strings
'switch' usage as follows :
'switch' '(' integerexpression ')' '{' [ 'case' integerconstantexpression [ '...' integerconstantexpression ']' ':' singlestatement ]* [ 'default' ':' singlestatement ] '}'
the switch statement is also valid for string expressions, for example:
switch (command) { case "turnleft": { TurnLeft (); break; } case "turnright": { TurnRight (); break; } default: llOwnerSay ("dont know how to handle " + command); }