fixed issue in documentation of while loop
This commit is contained in:
parent
7e3639d48b
commit
aae28f68b6
2 changed files with 8 additions and 12 deletions
14
Readme.md
14
Readme.md
|
|
@ -94,17 +94,13 @@ The while loop takes N arguments. The first argument, the conditional, must eval
|
||||||
```
|
```
|
||||||
(while (cond) (form1)....... (formN))
|
(while (cond) (form1)....... (formN))
|
||||||
|
|
||||||
(export iter 1)
|
(export cond T)
|
||||||
(while (< iter 4)
|
(while cond
|
||||||
(print (concat "current iteration: "
|
(print "this will only be printed once")
|
||||||
(string iter)))
|
(export cond F))
|
||||||
(export iter
|
|
||||||
(+ iter 1)))
|
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
current iteration: 1
|
this will only be printed once
|
||||||
current iteration: 2
|
|
||||||
current iteration: 3
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Comments
|
## Comments
|
||||||
|
|
|
||||||
|
|
@ -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
|
/* 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
|
* has rather progn like behavior in that it returns the result of the last form to be evaluated
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* (export cond F)
|
* (export cond T)
|
||||||
* (while cond (export cond T) (print "will only be printed once") (+ 1 2))
|
* (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
|
* 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 {
|
func ShsWhile(in *ast.Token, vt ast.VarTable, ft ast.FuncTable) *ast.Token {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue