summaryrefslogtreecommitdiffhomepage
path: root/forth.html.markdown
diff options
context:
space:
mode:
authorHorseMD <alightedness@gmail.com>2014-11-13 16:29:40 +0000
committerHorseMD <alightedness@gmail.com>2014-11-13 16:29:40 +0000
commitb2c704deaf460e97e89895f409368879e3f46f60 (patch)
tree2fddfc4d11c11d7a973913444f5f519cfaffe578 /forth.html.markdown
parentade01b4ad8258c9e12f86e2bb9aa5426f60bc500 (diff)
Fix missing comment, pull up a few lines.
Diffstat (limited to 'forth.html.markdown')
-rw-r--r--forth.html.markdown7
1 files changed, 1 insertions, 6 deletions
diff --git a/forth.html.markdown b/forth.html.markdown
index 8cfa46e4..11300159 100644
--- a/forth.html.markdown
+++ b/forth.html.markdown
@@ -16,7 +16,7 @@ Forth, but most of what is written here should work elsewhere.
\ Forth is an interactive programming language which is comprised of
\ *words*. These are Forth subroutines which are executed once you press
-<Cr>, from left to right.
+\ <Cr>, from left to right.
\ ------------------------------ Precursor ------------------------------
@@ -46,8 +46,6 @@ Forth, but most of what is written here should work elsewhere.
1360 23 - . \ 1337 ok
12 12 / . \ 1 ok
-\ And so on.
-
\ ----------------------------- Stack Manipulation -----------------------------
\ Naturally, as we work with the stack, we'll want some useful methods:
@@ -83,18 +81,15 @@ see square \ dup * ; ok
\ In forth, -1 is used to represent truth, and 0 is used to represent false.
\ The idea is that -1 is 11111111 in binary, whereas 0 is obviously 0 in binary.
\ However, any non-zero value is usually treated as being true:
-
42 42 = / -1 ok
12 53 = / 0 ok
\ `if` is a *compile-only word*. This means that it can only be used when we're
\ compiling a word. The format is `if` <stuff to do> `then` <rest of program>.
-
: ?>64 ( n -- n ) DUP 64 > if ." Greater than 64!" then ; \ ok
100 ?>64 \ Greater than 64! ok
\ Else:
-
: ?>64 ( n -- n ) DUP 64 > if ." Greater than 64!" else ." Less than 64!" then ;
100 ?>64 \ Greater than 64! ok
20 ?>64 \ Less than 64! ok