'Truthy' and 'falsy' expressions
- 'true' is evaluated to
- '1' is evaluated to
- non zero character is evaluated to
- empty string is evaluated to
- the string "foo" is evaluated to
- an object is evaluated to
- the array [0, 0] is evaluated to
- the array [0, 1] is evaluated to
- the array [1, 1] is evaluated to
- null value is evaluated to
- 'false' is evaluated to
- '0' is evaluated to
- zero character is evaluated to
- the string "false" is evaluated to
- the string "no" is evaluated to
- the string "off" is evaluated to
Using booleans as rendering conditions
|
th:if |
th:unless |
true |
will be rendered |
won't be rendered |
false |
won't be rendered |
will be rendered |
Boolean and conditional operators
A |
B |
${A or B} |
${A} or ${B} |
${A and B} |
${A} and ${B} |
${!A} |
!${A} |
${not A} |
not ${A} |
true |
true |
|
|
|
|
|
|
|
|
true |
false |
|
|
|
|
|
|
|
|
false |
true |
|
|
|
|
|
|
|
|
false |
false |
|
|
|
|
|
|
|
|
- the result of "true ? 'then'" is
- the result of "false ? 'then'" is
- the result of "true ? 'then' : 'else'" is
- the result of "false ? 'then' : 'else'" is
- the result of "'foo' ?: 'bar'" is
- the result of "null ?: 'bar'" is
- the result of "0 ?: 'bar'" is
- the result of "1 ?: 'bar'" is
- The weather is bad
- The weather is bad
- The weather is good
- The weather is good
- It's warm
- It's warm
- It's warm
- It's warm
- It's
#bools utility object
Array |
#bools.arrayIsTrue() |
#bools.arrayIsFalse() |
#bools.arrayAnd() |
#bools.arrayOr() |
[0, 0] |
|
|
|
|
[0, 1] |
|
|
|
|
[1, 1] |
|
|
|
|