Example: Understanding the Define-Evaluate Operation
You have to exercise caution when using the definition, the evaluation, and the range variable operators.
If you use the range variable operator to define a variable, then the result of evaluating that variable depends on how you evaluate it:
• If the definition and evaluation are done in-line, then the result is a vector.
• If the definition and evaluation are done in separate regions, then the result looks exactly like a vector but in fact it is simply a range variable.
In-Line Evaluation
1. Use the range variable operator to define and evaluate variable n in-line.
2. Verify that n is a vector by using the index operator to extract its first element.
Off-Line Evaluation
1. Use the range variable operator to define variable p and then evaluate variable p separately.
The result looks visually like a vector but in fact it is a range variable.
2. Verify that p is not a vector by using the index operator to extract its first element.
The error message says: This value must be vector.
3. Convert p into vector P.
4. Verify that P is a vector by using the index operator to extract its first element.