From 71a1f237dd678adfc0355e9c7546315280de2f17 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 26 May 2023 20:21:43 -0400 Subject: fix: js forth if statement so that string "0" is false --- forth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'forth.js') 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; -- cgit v1.2.3