0
What is the importance of the else if statement??
2 odpowiedzi
0
int age = 17;
if(age >= 18)
{
// age is greater than or equal to 18
}else if(age >= 15)
{
// age is greater than or equal to 15
}else
{
// runs if age is less than 18 and less then 15 this will run
}
"else if" can check for different conditions in the same if "block"
0
If : runs given a specific condition.
Else if: runs if a prior if statement's conditions was false and a specific condition is true.
If statements/else if statements have already been covered. Please usr the Q&A search before posting a question as to avoid creating a duplicate.