We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 61b1cf9 commit db07747Copy full SHA for db07747
misc_docs/syntax/controlflow_ifelse.mdx
misc_docs/syntax/language_if_else.mdx
@@ -0,0 +1,37 @@
1
+---
2
+id: "if-else"
3
+keywords: ["if", "else"]
4
+name: "if / else"
5
+summary: "This is the `if / else` control flow."
6
+category: "languageconstructs"
7
8
+
9
+Use `if / else` expressions to express a value through a `true` / `false` condition.
10
11
+### Example
12
13
+<CodeTab labels={["ReScript", "JS Output"]}>
14
15
+```res
16
+let user = "Anna"
17
18
+let greeting = if user === "Anna" {
19
+ "Hi Anna!"
20
+} else {
21
+ "Hi unknown!"
22
+}
23
+```
24
25
+```js
26
+var user = "Anna";
27
28
+var greeting = user === "Anna" ? "Hi Anna!" : "Hi unknown!";
29
30
31
+</CodeTab>
32
33
34
+### References
35
36
+* [If-Else & Ternary](/docs/manual/latest/control-flow#if-else--ternary)
37
0 commit comments