From 5287f6cd2b631a5fe288e043e61ffd862eb59c3e Mon Sep 17 00:00:00 2001 From: Shreyas Donti Date: Wed, 31 Aug 2022 11:19:13 +0530 Subject: [PATCH] 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 --- doc/site/control-flow.markdown | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/site/control-flow.markdown b/doc/site/control-flow.markdown index e1ffe218..a9a2b02e 100644 --- a/doc/site/control-flow.markdown +++ b/doc/site/control-flow.markdown @@ -61,6 +61,17 @@ if (ready) { } +You can also use `else if` branches to handle multiple possibilities. For example, what if `ready` was not a boolean value? +
+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!")
+}
+
+ ## Logical operators Unlike most other [operators][] in Wren which are just a special syntax for