diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-25 17:07:42 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-25 17:07:42 +0200 |
| commit | d4d0efdecd2e32687325f5a6a76a4a1a94b3c2d6 (patch) | |
| tree | 603c9b4cbb1126f701b03e2934d648808395c93b | |
| parent | 9793ae740a2fc14435b948244fc775214bc50ba7 (diff) | |
docs: Enhance README with comprehensive variable management documentation
- Updated Variable Management section with 'delete' command usage
- Added 'Working with Variables' section explaining:
- Variable persistence differences between REPL mode and bare mode
- Variable lifecycle and scope behavior
- Practical examples for both modes
| -rw-r--r-- | README.md | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -140,13 +140,35 @@ gt pi 3.14159 = pi 2 * # 2 * π gt vars # List all variables # x = 5 -gt name d # Delete variable +gt delete x # Delete a specific variable # Variable removed gt clear # Clear all variables # All variables cleared ``` +### Working with Variables + +Variables persist across commands in REPL mode but are cleared when exiting. In bare mode (single command), variables are only available within that command's execution context. + +Example: +```bash +# In bare mode, variables don't persist between commands +gt x 5 = # Assign x = 5 (in this command only) +# → x = 5 + +gt x # x is not defined in this separate command +# Error: variable not found + +# In REPL mode, variables persist +> x 5 = # Assign x = 5 +> x # x is still 5 +5 +> clear # Clear all variables +> x # x is now undefined +# Error: variable not found +``` + #### Stack Operations ```bash |
