Skip to content

Commit 46554ea

Browse files
authored
Fix typos and letter case
1 parent b53d4b9 commit 46554ea

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
@@ -14,12 +14,12 @@ A control flow structure. First evaluates _test_. If _test_ evaluates to `true`,
1414
The _test_ evaluates to `false` if its value is `false` or equal to `nil`. Every other value evaluates to `true`. In sense of PHP this means (`test != null && test !== false`).
1515

1616
```phel
17-
(if true 10) # evaluates to 10
18-
(if false 10) # evaluates to nil
19-
(if true (print 1) (print 2)) # prints 1 but not 2
20-
(if 0 (print 1) (print 2)) # prints 2
21-
(if nil (print 1) (print 2)) # prints 2
22-
(if [] (print 1) (print 2)) # prints 2
17+
(if true 10) # Evaluates to 10
18+
(if false 10) # Evaluates to nil
19+
(if true (print 1) (print 2)) # Prints 1 but not 2
20+
(if 0 (print 1) (print 2)) # Prints 2
21+
(if nil (print 1) (print 2)) # Prints 2
22+
(if [] (print 1) (print 2)) # Prints 2
2323
```
2424

2525
## Case
@@ -99,16 +99,16 @@ The `foreach` special form can be used to iterate over all kind of PHP datastruc
9999

100100
```phel
101101
(foreach [v [1 2 3]]
102-
(print v)) # prints 1, 2 and 3
102+
(print v)) # Prints 1, 2 and 3
103103
104104
(foreach [k v {"a" 1 "b" 2}]
105105
(print k)
106-
(print v)) # prints "a", 1, "b" and 2
106+
(print v)) # Prints "a", 1, "b" and 2
107107
```
108108

109109
## For
110110

111-
A more powerful loop functionality is provided by the `for` loop. The `for` loop is an elegant way to define and create arrays based on existing collections. It combines the functionality of `foreach`, `let` and `if` in one call.
111+
A more powerful loop functionality is provided by the `for` loop. The `for` loop is an elegant way to define and create arrays based on existing collections. It combines the functionality of `foreach`, `let`, `if` and `reduce` in one call.
112112

113113
```phel
114114
(for head body+)
@@ -144,8 +144,8 @@ have the form `:modifier argument`. The following modifiers are supported:
144144
(for [[k v] :pairs {:a 1 :b 2 :c 3}] [v k]) # Evaluates to [[1 :a] [2 :b] [3 :c]]
145145
(for [[k v] :pairs [1 2 3]] [k v]) # Evaluates to [[0 1] [1 2] [2 3]]
146146
147-
(for [x :in [2 2 2 3 3 4 5 6 6] :while (even? x)] x) # Evalutes to [2 2 2]
148-
(for [x :in [2 2 2 3 3 4 5 6 6] :when (even? x)] x) # Evalutaes to [2 2 2 4 6 6]
147+
(for [x :in [2 2 2 3 3 4 5 6 6] :while (even? x)] x) # Evaluates to [2 2 2]
148+
(for [x :in [2 2 2 3 3 4 5 6 6] :when (even? x)] x) # Evaluates to [2 2 2 4 6 6]
149149
150150
(for [x :in [1 2 3] :let [y (inc x)]] [x y]) # Evaluates to [[1 2] [2 3] [3 4]]
151151
@@ -169,11 +169,11 @@ The _expr_ is evaluated and thrown, therefore _expr_ must return a value that im
169169
All expressions are evaluated and if no exception is thrown the value of the last expression is returned. If an exception occurs and a matching _catch-clause_ is provided, its expression is evaluated and the value is returned. If no matching _catch-clause_ can be found the exception is propagated out of the function. Before returning normally or abnormally the optionally _finally-clause_ is evaluated.
170170

171171
```phel
172-
(try) # evaluates to nil
172+
(try) # Evaluates to nil
173173
174174
(try
175175
(throw (php/new \Exception))
176-
(catch \Exception e "error")) # evaluates to "error"
176+
(catch \Exception e "error")) # Evaluates to "error"
177177
178178
(try
179179
(+ 1 1)
@@ -182,7 +182,7 @@ All expressions are evaluated and if no exception is thrown the value of the las
182182
(try
183183
(throw (php/new \Exception))
184184
(catch \Exception e "error")
185-
(finally (print "test"))) # evaluates to "error" and prints "test"
185+
(finally (print "test"))) # Evaluates to "error" and prints "test"
186186
```
187187

188188
## Statements (do)

0 commit comments

Comments
 (0)