Skip to content

Commit 8487790

Browse files
author
sogaiu
committed
Mention new scopes for if and while
1 parent 42d6b08 commit 8487790

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

content/docs/specials.mdz

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ macro.
155155
The condition is considered false only if it evaluates to @code`nil` or
156156
@code`false` - all other values are considered @code`true`.
157157

158+
If when-true or when-false is evaluated, this is done in the context
159+
of a newly introduced lexical scope.
160+
158161
@codeblock[janet]```
159162
(if true 10) # evaluates to 10
160163
(if false 10) # evaluates to nil
@@ -211,6 +214,8 @@ or @code`nil`. Therefore, it is expected that the body will contain some side
211214
effects or the loop will go on forever. The @code`while` loop always evaluates
212215
to @code`nil`.
213216

217+
Note that the @code`while` special form introduces a new lexical scope.
218+
214219
@codeblock[janet]```
215220
(var i 0)
216221
(while (< i 10)

0 commit comments

Comments
 (0)