If
If is a keyword, which is use as a conditional operator. If keyword execute the statement only if condition is fulfilled.
if (condition) statement.
If-else
When if condition are false then the statement of else condition can execute
if (condition) statement1 else statement2.
In this code “a=10”,”b=9” there are not equal , so “if(a==b)” condition is not true .
the output is….
If-else-if
When 1st if condition can false then it execute else. If we want we can add more if condition with else.
if (condition) statement 1 else if (condition) statement 2 else.
In this code “a=10”,”b=9” there are not equal , so “if(a>b)” condition is not true .
the output is….
Comments
Post a Comment