-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(if): add documentation for if/elif/else
Signed-off-by: Flipez <code@brauser.io>
- Loading branch information
Showing
1 changed file
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
--- | ||
title: "If" | ||
title: "If / elif / else" | ||
menu: | ||
docs: | ||
parent: "controls" | ||
--- | ||
import CodeBlockSimple from '@site/components/CodeBlockSimple' | ||
|
||
# If | ||
With `if` and `else` keywords the flow of a program can be controlled. | ||
|
||
```js | ||
🚀 > if (a.type() == "STRING") | ||
puts("is a string") | ||
<CodeBlockSimple input='if (a.type() == "STRING") | ||
puts("is a string") | ||
else | ||
puts("is not a string") | ||
end | ||
puts("is not a string") | ||
end' output='is a string' /> | ||
|
||
# Elif | ||
`elif` allows providing of an additional consequence check after `if` and before evaluating the alternative provided by `else`. There is no limit on how many `elif` statements can be used. | ||
|
||
// which prints | ||
is a string | ||
``` | ||
<CodeBlockSimple input='if (a.type() == "BOOLEAN") | ||
puts("is a boolean") | ||
elif (a.type() == "STRING") | ||
puts("is a string") | ||
else | ||
puts("i have no idea")' output='is a string' /> |