Lesson 2: SETVAR [ MPE V to MPE XL: Getting Started ] MPE/iX 5.0 Documentation
MPE V to MPE XL: Getting Started
Lesson 2: SETVAR
SETVAR also allows for evaluation of expressions:
Examples:
* Whole number evaluation
__________________________________________________________________
| |
| |
| :SETVAR a, 5 |
| :SETVAR b, 4 |
| :SETVAR c, a+b |
| :SHOWVAR c |
| C = 9 |
| |
__________________________________________________________________
* String evaluation
__________________________________________________________________
| |
| |
| :SETVAR E, "Hi there," |
| :SETVAR F, E + " friend." |
| :SHOWVAR F |
| F = Hi there, friend. |
| |
__________________________________________________________________
* Boolean evaluation
________________________________________________________________
| |
| |
| :SETVAR a, 5 |
| :SETVAR b, 4 |
| :SETVAR c, a>b |
| :SHOWVAR c |
| C = TRUE |
| |
________________________________________________________________
Exercises
2a. Assign the value "John" to the variable NAME. Assign the value "Doe"
to the variable LASTNAME.
2b. Using SETVAR, link together (concatenate) NAME and LASTNAME, leaving
a space between the two so that "John Doe" appears on the screen in
an ECHO statement.
3. Repeat exercise 2b, but use CALC instead of SETVAR.
4. Calculate name=lastname.
MPE/iX 5.0 Documentation