aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordan <[email protected]>2023-05-26 20:58:11 -0400
committerdan <[email protected]>2023-05-26 20:58:11 -0400
commit1cc9bd9d82f970aba524ff57d9b67e9efac47ce9 (patch)
treed11adde9e6dcf6d2957c4e406c6640a589f4e9d4
parentf0b0efe498937562598b2d9467e986550d862327 (diff)
downloadforth-1cc9bd9d82f970aba524ff57d9b67e9efac47ce9.tar.gz
forth-1cc9bd9d82f970aba524ff57d9b67e9efac47ce9.tar.bz2
forth-1cc9bd9d82f970aba524ff57d9b67e9efac47ce9.zip
fix: js forth not statement so that string "0" inverts to true
-rw-r--r--forth.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/forth.js b/forth.js
index 3c7c0d2..5cea76f 100644
--- a/forth.js
+++ b/forth.js
@@ -48,7 +48,7 @@ function forth(print = console.log) {
return localIdx - initialIdx;
}
},
- 'not' : () => { s.push(!s.pop()) },
+ 'not' : () => { s.push(!popNum()) },
'.' : () => { print(s.pop()) },
'peek' : () => { print(s[s.length - 1]) },
'dup' : () => {