Skip to content

Commit

Permalink
Added an example of 'else if' to the docs (#1097)
Browse files Browse the repository at this point in the history
* Added an example of else if to the docs

* Added an example of else if to the Control Flow section of the docs
  • Loading branch information
stelleron authored Aug 31, 2022
1 parent 4ffe2ed commit 5287f6c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/site/control-flow.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ if (ready) {
}
</pre>

You can also use `else if` branches to handle multiple possibilities. For example, what if `ready` was not a boolean value?
<pre class="snippet">
if (ready == true) {
System.print("go!")
} else if (ready == false) {
System.print("not ready!")
} else { // If ready isn't a boolean
System.print("not sure if I'm ready or not!")
}
</pre>

## Logical operators

Unlike most other [operators][] in Wren which are just a special syntax for
Expand Down

0 comments on commit 5287f6c

Please sign in to comment.