Flow Control Primitives
Assignments¶
| Primitive | Description |
|---|---|
| dim | Dimensioned variable array |
| Assign | Operator x=y, sets variable x equal to the value y |
| Compound Assignment | Operator x??=y, arithmetic operation and assignment |
Procedures¶
| Primitive | Description |
|---|---|
| Procedure | Operator {x,y,...}, evaluates a series of steps in a new namespace |
| Parentheses | Operator (x,y,...), evaluates a series of steps in the current namespace |
| Function Call | Operator x(), calls a function |
Conditional¶
| Primitive | Description |
|---|---|
| Conditional | Operator x?y:z, if...then...else conditional |
| About the If Statement | If...then...else conditional Function form of if...then...else conditional |
| About the Switch Statement | Keyword - defines a switch statement |
Loops¶
| Primitive | Description |
|---|---|
| About the While statement | While loop |
| About the Do/While Statement | Keyword - defines a do()..while() loop |
| About the For Statement | For...next loop |
| About the For/In Statement | For...in loop |
| makelist | List of f(n) over a range of n |
| each | Applies a function to each element in a list |
| eachn | Applies a function to each element in a list with incrementing index |
| both | Applies a function to groups of corresponding elements in two lists |
| Dolist and Domatrix | Keyword - applies a function to parallel lists of input data Keyword - applies a function to independent lists of input data |
Breaks¶
| Primitive | Description |
|---|---|
| About the Continue Statement | Skips part of a for or while loop |
| About the Break Statement | Terminates a for or while loop |
| About the Return Statement | Returns the specified value from a function call |
| gate | Stops calculation when Logical Look-Ahead is active |
| err | Sets the error flag and terminates calculation |
| mask | Prevents calculation errors from terminating execution |
| maskcancel | Prevents the Cancel button from terminating execution |
| maskall | Prevents all errors from terminating execution |
| setinterval | Sets an interrupt that is called periodically during long calculations |
| sleep | Pauses execution for a specific amount of time |
Execution Control¶
| Primitive | Description |
|---|---|
| OnEnd | Node executed just before a model, component, or DLM ends |
| OnLoad | Node executed when a model, component, or DLM is loaded |
| OnStart | Node executed when a model, component, or DLM is started |
| Resource Tree | Node executed to load the resource tree for a model |
| primitive | Executes a command in the Primitive namespace |
| model | Executes a command in the Model namespace |
| unit | Executes a command in the Unit namespace |
| user | Executes a command in the User namespace |
| elapsedtime | Amount of time the current model has been open |
| namespace | Execute a command in the specified namespace |
Time-Based Analysis¶
| Primitive | Description |
|---|---|
| Time Assignment | Operator x?=y, assigns a time to a node value |
| Time Value | Operator x{y}, value of x at time y in a time-based analysis |
| t | Current execution time in a time-based model |
| t0 | Date and time serial number corresponding to the Period zero date. |
| pvx | Present value of a cash stream |
| tx | Date and time serial number equivalent of the period index t |
| dt | Period length in a time-based model |