summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJonathan Harford <jonathan.harford@gmail.com>2017-07-18 01:31:56 -0700
committerven <vendethiel@hotmail.fr>2017-07-18 10:31:56 +0200
commit6e7c5c793327f4a63b13e555894597915ca91fda (patch)
tree3c804707822744c20da1de54ff60fc8c3197781b
parent613702282ff30b0de1512158b04c1f588b0199e5 (diff)
[red/en] Fix logic in "either" examples (#2800)
-rw-r--r--red.html.markdown12
1 files changed, 6 insertions, 6 deletions
diff --git a/red.html.markdown b/red.html.markdown
index 0c979ce1..5f6ffc86 100644
--- a/red.html.markdown
+++ b/red.html.markdown
@@ -136,14 +136,14 @@ if a < 0 [print "a is negative"]
; Evaluate a block of code if a given condition is true, else evaluate an
; alternative block of code. If the last expressions in both blocks have the
; same type, EITHER can be used inside an expression.
-either a < 0 [
+either a > 0 [
+ msg: "positive"
+][
either a = 0 [
msg: "zero"
][
msg: "negative"
]
-][
- msg: "positive"
]
print ["a is " msg lf]
@@ -151,14 +151,14 @@ print ["a is " msg lf]
; There is an alternative way to write this
; (Which is allowed because all code paths return a value of the same type):
-msg: either a < 0 [
+msg: either a > 0 [
+ "positive"
+][
either a = 0 [
"zero"
][
"negative"
]
- ][
- "positive"
]
print ["a is " msg lf]