forked from Mirror/wren
Added an example of 'else if' to the docs (#1097)
* Added an example of else if to the docs * Added an example of else if to the Control Flow section of the docs
This commit is contained in:
@ -61,6 +61,17 @@ if (ready) {
|
|||||||
}
|
}
|
||||||
</pre>
|
</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
|
## Logical operators
|
||||||
|
|
||||||
Unlike most other [operators][] in Wren which are just a special syntax for
|
Unlike most other [operators][] in Wren which are just a special syntax for
|
||||||
|
|||||||
Reference in New Issue
Block a user