From b5efca78515d7e7f8b4ed1fde33184933c363775 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Sun, 21 Sep 2025 18:22:07 -0700 Subject: [PATCH] Fix: Clarify ternary expression return value of -0 --- index.html | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index d322e83..7202c8b 100644 --- a/index.html +++ b/index.html @@ -176,15 +176,15 @@ Hi dispenses with boolean keywords in favor of canonical numeric values for trut ## Conditional Expressions -All conditional logic is handled by a single ternary expression structure, which always returns a value. +All conditional logic is handled by a single ternary expression structure, which *always* returns a value. If a condition is false and no \`else\` branch exists, or if the executed block doesn't produce a value (e.g., its last statement is an assignment), the expression evaluates to \`-0\` (null). \`\`\`javascript -// if -(1 < 2) ? { _("True") } - // if / else result: (1 > 2) ? { "A" } : { "B" } // result is "B" +// A missing 'else' on a false condition results in -0 +value: (1 > 2) ? { "A" } // value is -0 + // if / else if / else score: 75 grade: (score >= 90) ? { "A" } @@ -423,4 +423,3 @@ To create the initial Hi-to-JS transpiler, the following primitives and built-in -