From f12f89ab0b9acc74a8c6ab1a78cae1708a004876 Mon Sep 17 00:00:00 2001 From: Divay Prakash Date: Sat, 27 Oct 2018 18:24:03 +0530 Subject: Explain initialize, closes #1467 --- red.html.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'red.html.markdown') diff --git a/red.html.markdown b/red.html.markdown index 3575032f..73baf462 100644 --- a/red.html.markdown +++ b/red.html.markdown @@ -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 -- cgit v1.2.3 From 63ab96e72a704175133901657bfc52fb9b45d132 Mon Sep 17 00:00:00 2001 From: Peter Lewerin Date: Sat, 24 Nov 2018 20:21:26 +0100 Subject: Update red.html.markdown The inequality operator was given as "!=", should be "<>". The until construct was described as not returning a value: it always returns true if it finishes. --- red.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'red.html.markdown') diff --git a/red.html.markdown b/red.html.markdown index 73baf462..9cf6c31d 100644 --- a/red.html.markdown +++ b/red.html.markdown @@ -114,12 +114,12 @@ i2 * i1 ; result 2 i1 / i2 ; result 0 (0.5, but truncated towards 0) ; Comparison operators are probably familiar, and unlike in other languages -; you only need a single '=' sign for comparison. +; you only need a single '=' sign for comparison. Inequality is '<>' like in Pascal. ; There is a boolean like type in Red. It has values true and false, but also ; the values on/off or yes/no can be used 3 = 2 ; result false -3 != 2 ; result true +3 <> 2 ; result true 3 > 2 ; result true 3 < 2 ; result false 2 <= 2 ; result true @@ -165,7 +165,7 @@ print ["a is " msg lf] ; until ; Loop over a block of code until the condition at end of block, is met. -; UNTIL does not return any value, so it cannot be used in an expression. +; UNTIL always returns the 'true' value from the final evaluation of the last expression. c: 5 until [ prin "o" -- cgit v1.2.3 From 7522161aecbca946c15127cb0dd7d556a4a48f33 Mon Sep 17 00:00:00 2001 From: Peter Lewerin Date: Mon, 26 Nov 2018 09:56:09 +0100 Subject: Update red.html.markdown --- red.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'red.html.markdown') diff --git a/red.html.markdown b/red.html.markdown index 9cf6c31d..74538bd7 100644 --- a/red.html.markdown +++ b/red.html.markdown @@ -129,8 +129,8 @@ i1 / i2 ; result 0 (0.5, but truncated towards 0) ; Control Structures ; ; if -; Evaluate a block of code if a given condition is true. IF does not return -; any value, so cannot be used in an expression. +; Evaluate a block of code if a given condition is true. IF returns +; the resulting value of the block or 'none' if the condition was false. if a < 0 [print "a is negative"] ; either -- cgit v1.2.3