if
statementif
statement is a programming conditional statement that, if proved true, executes the code given in the block. Below is a general example of an if statement in V:println()
will only execute when the condition is true. There are no parentheses needed for surrounding the condition, and the braces are always required.else
statementelse
statement is a programming conditional statement in which when if
evaluates to false then the code in else
block executes.else
block will execute because the condition in if
evaluates to false
.else if
statementif...else
statement executes two different codes depending upon whether the test expression is true
or false
. Sometimes, a choice has to be made from more than 2 possibilities. The if...else if...else
ladder allows you to check between multiple test expressions and execute different statements.if..else
statementif...else
statements which means you can use one if
, else
or else...if
statement inside another if
or else...if
statement.if..else
as expressionif..else
can also be used as an expression: