12.3.1 If/elseif/else
The #if instruction in velocity allows text to be included when a page is generated, if the IF condition is true. For example:
#if ($foo)
<strong>Velocity!</strong>
#end
The variable $foo evaluated first to determine whether it is true. True in either case: (i) $foo is a logical variable with a true value, or (ii) a value that is not empty. Remember that the velocity context includes only objects, so when we say "Boolean" Boolean, he is represented as "Boolean" (Boolean Class). This is true even for methods that return Boolean types-introspection schemas will return a Boolean class with the same logical value.
If the evaluation is true, the content between the #if and the #end statement is output. In this case, if the $foo is true, the output will be "velocity!". Conversely, if the $foo has a null value or is logically false and the statement evaluation is false, there is no output.
A #elseif or #else item can be used in a #if statement. Note that the Velocity template engine will stop when the first expression is true. In the following example, suppose $foo has a value of 15 and $bar equals 6.
#if ($foo <)
<strong>go north</strong>
#elseif ($foo = a)
<strong>go east</ Strong>
#elseif ($bar = 6)
<strong>go south</strong>
#else
<strong>go West </strong>
#end
In this example, the $foo is greater than 10, so the previous two comparisons fail. Next compares $bar and 6, the result is true, so the output is go South.
Note that at this time velocity's numeric comparison constraint is integral-all other types will be evaluated to false. There is only one exception equals ' = = ', at which point velocity requires the same type of object on both sides of the equal sign.
From:https://wizardforcel.gitbooks.io/velocity-doc/content/22.html