An if-else statement allows a program to execute different code depending on whether a condition is true or false. It provides conditional execution which is useful for making decisions within programs. The if statement checks a condition and executes code if the condition is true, while the else statement executes code if the condition is false.