From d4d0efdecd2e32687325f5a6a76a4a1a94b3c2d6 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 25 Mar 2026 17:07:42 +0200 Subject: 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 --- README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3