- Get link
- X
- Other Apps
In computer programming, IF–ELSE is generally called a:
Conditional Statement
or
Selection Statement / Selection Control Structure
It is used to make a decision based on whether a condition is TRUE or FALSE.
| Term | Meaning |
|---|---|
| Conditional Statement | A statement that executes code based on a condition |
| Selection Statement | A control structure that selects which code to execute |
| Decision-Making Statement | Describes its purpose: making a program decision |
| Branching Statement | Emphasizes that program execution branches into different paths |
| IF Statement | Executes code when a condition is true |
| IF–ELSE Statement | Chooses between two alternative paths |
Basic structure
IF (condition) {
// execute when TRUE
}
ELSE {
// execute when FALSE
}
For example:
if (age >= 18) {
System.out.println("Adult");
} else {
System.out.println("Minor");
}
So, if you are classifying program control structures, a common hierarchy is:
CONTROL STRUCTURES
│
├── 1. SEQUENCE
│
├── 2. SELECTION / CONDITIONAL
│ ├── if
│ ├── if-else
│ ├── if-else-if
│ └── switch-case
│
└── 3. ITERATION / LOOPING
├── for
├── while
└── do-while
Best general term: Selection (Conditional) Control Structure.
Comments