if statement
nounUK /ɪf ˈsteɪtmənt/
US /ɪf ˈsteɪtmənt/
A line of code that does something only when a rule is true.
The program uses an if statement to check if the password is correct.
OTHER MEANINGS
2. A sentence in a computer program that asks a yes-or-no question.
Add an if statement to see if the number is bigger than ten.
3. A way to tell a computer to choose between two actions.
The if statement tells the game to show 'You win!' when the score is high.
4. A programming instruction that runs a block of code only under certain conditions.
Without the if statement, the alarm would ring every morning.