Conditions
Create if / else
conditions
if / else
conditionsSyntaxe
if (<condition>) {
<block>
} else {
<block>
}
Condition:
Anything with logical operator used for variables comparison
"!=" | "==" | ">" | "<" | ">=" | "<="| "&&" | "||"
Examples:
if (i <= 10) {
<block>
} else {
<block>
}
if (a % 2 != 0 && a % 3 != 0) {
<block>
} else {
<block>
}
Last updated
Was this helpful?