Programming Concepts Tutorial

Learn the fundamental concepts of computer programming

If Statements

If Statements (Conditionals)

Conditional statements allow your program to make decisions based on certain conditions.

How it works:

  • IF a condition is true, execute a block of code.
  • ELSE IF (optional) check another condition if the first was false.
  • ELSE (optional) execute a fallback block of code if all conditions are false.

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics