ifstatement 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.
elsestatement is a programming conditional statement in which when
ifevaluates to false then the code in
elseblock will execute because the condition in
if...elsestatement executes two different codes depending upon whether the test expression is
false. Sometimes, a choice has to be made from more than 2 possibilities. The
if...else if...elseladder allows you to check between multiple test expressions and execute different statements.
if...elsestatements which means you can use one
else...ifstatement inside another
if..elsecan also be used as an expression: