diff options
Diffstat (limited to 'red.html.markdown')
-rw-r--r-- | red.html.markdown | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/red.html.markdown b/red.html.markdown index 0c979ce1..73baf462 100644 --- a/red.html.markdown +++ b/red.html.markdown @@ -51,7 +51,7 @@ comment { ; no need to restrict this to a 'main' function. ; Valid variable names start with a letter and can contain numbers, -; variables containing only capital A thru F and numbers and ending with 'h' +; variables containing only capital A through F and numbers and ending with 'h' ; are forbidden, because that is how hexadecimal numbers are expressed in Red ; and Red/System. @@ -103,7 +103,8 @@ type? my-integer integer! ; A variable can be initialized using another variable that gets initialized -; at the same time. +; at the same time. Initialize here refers to both declaring a variable and +; assigning a value to it. i2: 1 + i1: 1 ; Arithmetic is straightforward @@ -136,14 +137,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 +152,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] |