Difference between revisions of "Expressions"
From Wiki
m (→Expressions) |
m (→Statements) |
||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
Expressions are important building blocks in an EasyUO script. They can be used to create relatively advanced integer mathematics. | Expressions are important building blocks in an EasyUO script. They can be used to create relatively advanced integer mathematics. | ||
− | An expression | + | An expression is any of the following: |
+ | * a literal | ||
+ | * a variable | ||
+ | * an expression enclosed with parenthesis | ||
+ | * an unary operator followed by an expression | ||
+ | * an expression followed by a binary operator and an expression | ||
+ | |||
+ | |||
<pre> | <pre> | ||
− | set %var 2 + 2</pre> | + | set %var 1337 ; literal numeric value |
+ | set %name cheffe ; literal string value | ||
+ | set %temp %var | ||
+ | set %faux ! #true ; unary operator | ||
+ | set %var %var + 1 ; binary operator | ||
+ | set %calculus ( 2 + 2 ) * ( 3 - 1 ) ; parenthesis enclosed expressions</pre> | ||
===Statements=== | ===Statements=== | ||
− | |||
An EasyUO script is a sequence of statements. A statement is any of the following: | An EasyUO script is a sequence of statements. A statement is any of the following: | ||
− | + | * a command | |
− | + | * a block | |
− | + | * a control structure | |
A command typically takes the form: <command_name> <parameters> | A command typically takes the form: <command_name> <parameters> | ||
Example: | Example: | ||
− | set %var 2 + 2 | + | <pre>set %var 2 + 2</pre> |
− | A block is a sequence of statements grouped within brackets. Opening and closing brackets | + | A block is a sequence of statements grouped within brackets. Opening and closing brackets ''must'' occurs on a distinct line (Hence one could argue that both "{" and "}" are statements by themselves). Blocks are almost exclusively used in conjunction with control structures. |
− | <pre> | + | <pre>{ |
− | { | + | |
set %var 2 + 2 | set %var 2 + 2 | ||
display ok %var | display ok %var | ||
Line 29: | Line 39: | ||
Control structure are defined individually elsewhere in the documentation. | Control structure are defined individually elsewhere in the documentation. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| | {| | ||
| Width=200px | [[Main_Page]] || Width=200px | [[Documentation]] || Width=200px | | | Width=200px | [[Main_Page]] || Width=200px | [[Documentation]] || Width=200px | | ||
|} | |} |
Latest revision as of 12:50, 17 July 2007
Contents
Expressions
Expressions are important building blocks in an EasyUO script. They can be used to create relatively advanced integer mathematics.
An expression is any of the following:
- a literal
- a variable
- an expression enclosed with parenthesis
- an unary operator followed by an expression
- an expression followed by a binary operator and an expression
set %var 1337 ; literal numeric value set %name cheffe ; literal string value set %temp %var set %faux ! #true ; unary operator set %var %var + 1 ; binary operator set %calculus ( 2 + 2 ) * ( 3 - 1 ) ; parenthesis enclosed expressions
Statements
An EasyUO script is a sequence of statements. A statement is any of the following:
- a command
- a block
- a control structure
A command typically takes the form: <command_name> <parameters>
Example:
set %var 2 + 2
A block is a sequence of statements grouped within brackets. Opening and closing brackets must occurs on a distinct line (Hence one could argue that both "{" and "}" are statements by themselves). Blocks are almost exclusively used in conjunction with control structures.
{ set %var 2 + 2 display ok %var }
Control structure are defined individually elsewhere in the documentation.
Main_Page | Documentation |