summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/rpn/variables.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/rpn/variables.go b/internal/rpn/variables.go
index de98e2f..5214403 100644
--- a/internal/rpn/variables.go
+++ b/internal/rpn/variables.go
@@ -14,6 +14,14 @@ var (
)
// Value represents a variant type that can hold either a number (float64) or a boolean.
+//
+// When used in arithmetic operations, boolean values are automatically coerced:
+// - true → 1
+// - false → 0
+//
+// This allows boolean results from comparison operations to be used directly in
+// arithmetic expressions (e.g., "5 3 == 1 +" where "5 3 ==" produces false=0,
+// and "0 + 1" produces 1).
type Value struct {
isBool bool
boolVal bool