aboutsummaryrefslogtreecommitdiffstats
path: root/forth.js
diff options
context:
space:
mode:
authordan <[email protected]>2023-05-26 20:21:43 -0400
committerdan <[email protected]>2023-05-26 20:21:43 -0400
commit71a1f237dd678adfc0355e9c7546315280de2f17 (patch)
treedc2f7f2ce654986c46330790013cc547a8fc20f3 /forth.js
parent1d059ec9193202a7508134c1ec65364286f945ac (diff)
downloadforth-71a1f237dd678adfc0355e9c7546315280de2f17.tar.gz
forth-71a1f237dd678adfc0355e9c7546315280de2f17.tar.bz2
forth-71a1f237dd678adfc0355e9c7546315280de2f17.zip
fix: js forth if statement so that string "0" is false
Diffstat (limited to 'forth.js')
-rw-r--r--forth.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/forth.js b/forth.js
index 436387a..3c7c0d2 100644
--- a/forth.js
+++ b/forth.js
@@ -42,7 +42,7 @@ function forth(print = console.log) {
},
'then' : () => {/*Doing nothing skips the token*/},
'if' : (initialIdx, tokens) => {
- if (!s.pop()) {
+ if (!popNum()) {
let localIdx = initialIdx;
while (tokens[localIdx] && tokens[localIdx] !== 'then') {localIdx++}
return localIdx - initialIdx;