From 2fa4ca9892a8c7c212579fb52f32769fcc830fad Mon Sep 17 00:00:00 2001 From: Alexander McCord <11488393+alexmccord@users.noreply.github.com> Date: Wed, 23 Mar 2022 15:35:53 -0700 Subject: [PATCH] Minor change to the example. --- rfcs/syntax-if-expression.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rfcs/syntax-if-expression.md b/rfcs/syntax-if-expression.md index 32776eb5..76f76cf1 100644 --- a/rfcs/syntax-if-expression.md +++ b/rfcs/syntax-if-expression.md @@ -37,12 +37,12 @@ MyComponent.validateProps = t.strictInterface({ Note that `else` is mandatory because it's always better to be explicit. If it weren't mandatory, it opens the possiblity that someone might be writing a chain of if-then-else and forgot to add in the final `else` that _doesn't_ return a `nil` value! Enforcing this syntactically ensures the program does not run. Also, with it being mandatory, it solves many cases where parsing the expression is ambiguous due to the infamous [dangling else](https://en.wikipedia.org/wiki/Dangling_else). -This example will not do what it looks like it's supposed to do! It will _successfully_ parse and be interpreted as to return `h()` if `g()` evaluates to some falsy value, when in actual fact the clear intention is to evaluate `h()` only if `f()` is falsy. +This example will not do what it looks like it's supposed to do! The if expression will _successfully_ parse and be interpreted as to return `h()` if `g()` evaluates to some falsy value, when in actual fact the clear intention is to evaluate `h()` only if `f()` is falsy. ```lua if f() then ... - return if g() then x + local foo = if g() then x else h() ...