summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-25 17:07:42 +0200
committerPaul Buetow <paul@buetow.org>2026-03-25 17:07:42 +0200
commitd4d0efdecd2e32687325f5a6a76a4a1a94b3c2d6 (patch)
tree603c9b4cbb1126f701b03e2934d648808395c93b
parent9793ae740a2fc14435b948244fc775214bc50ba7 (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.md24
1 files changed, 23 insertions, 1 deletions
diff --git a/README.md b/README.md
index 2c40674..329e086 100644
--- a/README.md
+++ b/README.md
@@ -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