API / Apache FreeMarker Interview questions
List the comparison operators supported in FreeMarker?
FreeMarker supports the usual equality and ordering operators, plus word aliases for the angle-bracket forms because < and > can be ambiguous inside tag syntax.
| Operator | Meaning | Word alias |
| == | Equal to | - |
| != | Not equal to | - |
| < | Less than | lt |
| > | Greater than | gt |
| <= | Less than or equal | lte |
| >= | Greater than or equal | gte |
Inside an <#if> tag, writing count > 0 can confuse the parser because > looks like it might close the tag, so many style guides prefer count gt 0, or wrapping the expression in parentheses, to keep templates unambiguous.
More Related questions...