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

Relational and logical operators
Template Engine uses the equality operator (==) to determine the relationship between variables, and logical operators (and, or, not) for boolean conditions.
Relational condition
#set($first = "foo")
#set($last = "bar")
#if($first == $last)
  First and Last are equal.
#else
  First and Last are not equal.
#end
The output in this example is First and Last are not equal.
Logical AND condition
#if( $foo && $bar )
   <b> This AND that</b>
#end
The #if directive will only evaluate to true if both $foo and $bar are true.
Logical OR condition
#if( $foo || $bar )
   <b> This OR that</b>
#end
The #if directive will evaluate to true if any of the variables $foo or $bar is true.
Logical NOT condition
#if( !$bar )
   <b> NOT this</b>
#end
The #if directive will only evaluate to true if $bar is false.
OpenText StreamServe 5.6 Updated: 2013-03-01