From aae28f68b67fd1339a872d65048aadc729d2c862 Mon Sep 17 00:00:00 2001 From: Aidan Date: Sun, 23 May 2021 22:01:46 -0700 Subject: [PATCH] fixed issue in documentation of while loop --- Readme.md | 14 +++++--------- stdlib/control_flow.go | 6 +++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Readme.md b/Readme.md index 0a3fdc7..42f50ec 100644 --- a/Readme.md +++ b/Readme.md @@ -94,17 +94,13 @@ The while loop takes N arguments. The first argument, the conditional, must eval ``` (while (cond) (form1)....... (formN)) -(export iter 1) -(while (< iter 4) - (print (concat "current iteration: " - (string iter))) - (export iter - (+ iter 1))) +(export cond T) +(while cond + (print "this will only be printed once") + (export cond F)) Output: -current iteration: 1 -current iteration: 2 -current iteration: 3 +this will only be printed once ``` ## Comments diff --git a/stdlib/control_flow.go b/stdlib/control_flow.go index 51c4deb..e02def5 100644 --- a/stdlib/control_flow.go +++ b/stdlib/control_flow.go @@ -77,9 +77,9 @@ func ShsIf(in *ast.Token, vt ast.VarTable, ft ast.FuncTable) *ast.Token { /* continually eval n forms while element #1 evals to T * has rather progn like behavior in that it returns the result of the last form to be evaluated * - * Example: - * (export cond F) - * (while cond (export cond T) (print "will only be printed once") (+ 1 2)) + * Example: + * (export cond T) + * (while cond (export cond F) (print "will only be printed once") (+ 1 2)) * loop will iter one time, print "will only be printed once" and return 3 */ func ShsWhile(in *ast.Token, vt ast.VarTable, ft ast.FuncTable) *ast.Token {