Template Engine language reference > Directives > The #if, #elseif and #else directives

The #if, #elseif and #else directives
The #if directive makes it possible to conditionally render a piece of text or execute a directive when a condition evaluates to true.
#set($bool = true)
#if( $bool )
  <p>hello world</p>
#end
<p>hello world</p>
An #elseif or #else element can be used with an #if element. Note that Template Engine will stop at the first expression that is found to be true.
#set($value = 10)
#if( $value < 10 )
   Value is less than 10
#elseif( $value == 10 )
   Value is 10
#elseif( $value > 10 )
   Value is greater than 10
#else
  Value could not be determined
#end
Value is 10
OpenText StreamServe 5.6 Updated: 2013-03-01