The if, elseif, and else Statements
It’s time for your programs to make decisions. As variables within your program change, there will be times when you’ll want to test to see if a variable meets certain conditions.
The example I’ll use throughout this chapter is an online login form. If a visitor enters the correct username and password, he has been verified as someone with special permission to see whatever the program does. On the other hand, if the visitor doesn’t enter the right username and password, he shouldn’t be given any sort of privileges.
This chapter teachers you the following:
The fundamentals of Boolean comparison
Conditional expressions and operators
How to combine expressions with logical operators
How to nest conditionals