We can test many conditions using the if else if al statement.
You saw the normal LaFalce lets you test one condition if the condition is true, Javor runs the if
statement and if the condition is false, Java skips the statement and runs the code inside ELT's.
In this lesson, you're going to learn to use, if else, if else, to test many conditions.
Between anything else, you can have many Elsas statements and Java only runs the first statement that
ends up being true.
The rest are ignored.
So back in her coat, I'm going to change the grade back to 65 five and I'm going to change the first
condition to say if grade is bigger than or equal to 80, then I'm going to print.
You got in a.
And now I'm going to write a series of statements based on the image we just saw, so we'll say else
if greed is bigger than or equal to 70.
Well, print, you've got to be.
And if it's greater than or equal to 60.
We'll say you got to see.
And if it's greater than or equal to 50.
Will print, you got a D.
Otherwise, you got enough.
That's runner code.
And the students scored at 65, which warrants a C.
The first condition is false.
The second condition is false, and the third condition is true because the student's grade is higher
than 60.
The other runs that code and it ignores the rest.
So instead of sixty five, we're going to set the students grade to 40.
All right, rerunning that code.
You've got enough.
That is because all the conditions are false.
So Jova runs the statement.
I encourage you to play with the great value in test each condition.
In this lesson, you changed a series of, if elusive final statements, Java tests each statement until
one of them is true and then it runs the code inside.
And if all the conditions are false, Java runs the statements.