Skip to content

Commit 3e695d7

Browse files
authored
Merge pull request #113 from jasalt/master
docs / control-flow: fix exception heading level, rearrange
2 parents 76544d0 + 1b3e35e commit 3e695d7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

content/documentation/control-flow.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,19 @@ have the form `:modifier argument`. The following modifiers are supported:
155155
(for [x :range [0 4] y :range [0 x]] [x y]) # Evaluates to [[1 0] [2 0] [2 1] [3 0] [3 1] [3 2]]
156156
```
157157

158+
# Do
159+
160+
```phel
161+
(do expr*)
162+
```
163+
164+
Evaluates the expressions in order and returns the value of the last expression. If no expression is given, `nil` is returned.
165+
166+
```phel
167+
(do 1 2 3 4) # Evaluates to 4
168+
(do (print 1) (print 2) (print 3)) # Print 1, 2, and 3
169+
```
170+
158171
# Dofor
159172

160173
```
@@ -164,7 +177,7 @@ have the form `:modifier argument`. The following modifiers are supported:
164177

165178
Iterating over collections for side-effects is also possible with `dofor` which has similar behavior to `for` otherwise but returns `nil` as `foreach` does.
166179

167-
## Exceptions
180+
# Exceptions
168181

169182
```phel
170183
(throw expr)
@@ -196,16 +209,3 @@ All expressions are evaluated and if no exception is thrown the value of the las
196209
(catch \Exception e "error")
197210
(finally (print "test"))) # Evaluates to "error" and prints "test"
198211
```
199-
200-
## Statements (do)
201-
202-
```phel
203-
(do expr*)
204-
```
205-
206-
Evaluates the expressions in order and returns the value of the last expression. If no expression is given, `nil` is returned.
207-
208-
```phel
209-
(do 1 2 3 4) # Evaluates to 4
210-
(do (print 1) (print 2) (print 3)) # Print 1, 2, and 3
211-
```

0 commit comments

Comments
 (0)