id | keywords | name | summary | category | ||
---|---|---|---|---|---|---|
if-else |
| if / else | This is the `if / else` control flow. | languageconstructs |
Use if / else
expressions to express a value through a true
/ false
condition.
<CodeTab labels={["ReScript", "JS Output"]}>
letuser="Anna"letgreeting=ifuser==="Anna" { "Hi Anna!" } else { "Hi unknown!" }
varuser="Anna";vargreeting=user==="Anna" ? "Hi Anna!" : "Hi unknown!";