Conditionals Statement
A conditional statement is a set of rules performed if a certain condition is met. A conditional statement begins with the keyword if followed by parentheses. The result of the evaluation is true or false.
·
‘ if ‘ statement
·
‘ if-else ‘ statement
·
Nested ‘ if ‘
statement
·
‘ if-else - if ‘ statement
IF statement: ‘IF’ statement is the most basic
and simple statement among all the statements. For example- if a value is less
than 0, return “Negative value”.
Let’s see
an example-
IF-ELSE statement: The if-else is statement is
an extended version of If.
Let’s see an example-
Nested
IF-ELSE statement: In
Java, when there is an if statement inside another if statement then it is
known as nested if-else.
Let’s see
an example-
IF-ELSE-IF: ‘ if-else-if ’ statement is used when
we need to check multiple conditions. ‘ if-else if statement is also known as if-else-if
ladder
Let’s see
an example-
Comments
Post a Comment