if-else definition made more clear to avoid confusion (#25449)
This commit is contained in:
committed by
Manish Giri
parent
03a576e7b1
commit
773aae4fdc
@ -3,15 +3,15 @@ title: If-Else Statement
|
|||||||
---
|
---
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
The `if` statement executes a statement if a specified condition is `true`. If the condition is `false`, another statement can be executed using the `else` statement.
|
The `if` statement executes a statement if a specified condition is `true`. If the condition is `false`, then the statement inside `else` block gets executed.
|
||||||
|
|
||||||
**Note:** The `else` statement is optional.
|
**Note:** The `else` statement is optional.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
if (condition) {
|
if (condition) {
|
||||||
/* do something */
|
/* do this if condition is TRUE */
|
||||||
} else {
|
} else {
|
||||||
/* do something else */
|
/* do this if condition is FALSE (or not TRUE) */
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user