diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-23 20:31:39 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-23 20:31:39 +0300 |
| commit | 5f6875c97bebd0c2f677f38e4e06367b0414e182 (patch) | |
| tree | 482562ccba911a6085123a157534854201658fe9 | |
| parent | b379e39ce81a995812895f4aa4fe079372f76ba0 (diff) | |
docs: fix README discrepancies — remove 'delete x', add comparison operators
Remove 'delete x' command documentation (not implemented; only
'clear' clears all variables).
Add Comparison Operators section documenting gt/lt/gte/lte/eq/neq
and shorthand symbols (>/</>=/<=/==/!=) with examples. These
operators were used in Boolean-to-Number Coercion examples but
never documented.
| -rw-r--r-- | README.md | 59 |
1 files changed, 48 insertions, 11 deletions
@@ -213,17 +213,6 @@ gt 'pi' # Now returns the constant π # → 3.141592654 ``` -```bash -gt 'vars' # List all variables -# x = 5 - -gt 'delete x' # Delete a specific variable -# Variable removed - -gt 'clear' # Clear all variables (also restores overridden built-in constants) -# All variables cleared -``` - See the Constant Management section for the `constants` command to list all available constants. ### Working with Variables @@ -284,6 +273,54 @@ To show the current stack without modifying it: 45 ``` +## Comparison Operators + +Comparison operators push a boolean result (`true`/`false`) onto the stack: + +```bash +gt '5 3 gt' # 5 > 3 +# → true + +gt '3 5 lt' # 3 < 5 +# → true + +gt '5 5 gte' # 5 >= 5 +# → true + +gt '5 5 lte' # 5 <= 5 +# → true + +gt '5 5 eq' # 5 == 5 +# → true + +gt '5 3 neq' # 5 != 3 +# → true +``` + +Shorthand symbols are also supported: + +```bash +gt '5 3 >' # Same as gt +# → true + +gt '3 5 <' # Same as lt +# → true + +gt '5 5 >=' # Same as gte +# → true + +gt '5 5 <=' # Same as lte +# → true + +gt '5 5 ==' # Same as eq +# → true + +gt '5 3 !=' # Same as neq +# → true +``` + +Comparison operators are metric-aware: they work with numbers that have attached units. + ## Boolean-to-Number Coercion Boolean values are automatically coerced to numbers when used in arithmetic operations: |
