if-else statement

noun
UK /ɪf ɛls ˈsteɪtmənt/
US /ɪf ɛls ˈsteɪtmənt/

A rule in a computer program that says do one thing if something is true, and another thing if it is not.

The program uses an if-else statement to show 'Good morning' before noon and 'Good evening' after.


OTHER MEANINGS

2. A programming construct that chooses between two blocks of code based on a test.

She replaced the nested if-else statement with a switch for clarity.

3. A way to make a program react differently to different situations.

The game's if-else statement decides whether the player wins or loses.

4. A basic building block of decision-making in code.

Every beginner learns the if-else statement before loops.