18. Compare numbers and live values
Figure 14. If Compare accepts a live expression on either side and a chosen comparison operator.
1. Add If Compare.
2. In Left, enter {"$var":"score"}. Commit the field.
3. Choose >= under Compare.
4. In Right, enter 10.
5. Connect TRUE to the “enough points” response and FALSE to the “not yet” response.
6. Test with score 9, 10 and 11. Ten belongs on the TRUE path because the operator includes equality.
| Operator | Meaning |
|---|---|
| == | Equal |
| != | Different |
| < / <= | Less than / less than or equal to |
| > / >= | Greater than / greater than or equal to |
Use equality for IDs, text and flags. Use the ordering operators for genuine numeric values. This runner converts operands to numbers for <, <=, > and >=, so those operators are not an alphabetical text-sorting feature.
Typing score by itself produces a literal string in a JSON-value field. The dictionary {"$var":"score"} is what asks the runner to read the current score.
