1
0
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:
Shreyas Donti
2022-08-31 11:19:13 +05:30
committed by GitHub
parent 4ffe2ed38b
commit 5287f6cd2b

View File

@ -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