Operators > Definition and Evaluation Operators > Example: Understanding the Define-Evaluate Operation
  
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.
Click to copy this expression
2. Verify that n is a vector by using the index operator to extract its first element.
Click to copy this expression
Off-Line Evaluation
1. Use the range variable operator to define variable p and then evaluate variable p separately.
Click to copy this expression
Click to copy this expression
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.
Click to copy this expression
The error message says: This value must be vector.
3. Convert p into vector P.
Click to copy this expression
Click to copy this expression
4. Verify that P is a vector by using the index operator to extract its first element.
Click to copy this expression