Kestra Expressions Operators, Tags, and Tests
Use this page when you need the control-flow side of Pebble rather than data transformation helpers.
Operators
Comparisons
Supported comparison operators:
==!=<><=>=
Logic and boolean checks
Use:
andornotiscontains
Examples:
{% if 2 is even and 3 is odd %} ...{% endif %}
{% if ["apple", "pear", "banana"] contains "apple" %} ...{% endif %}Math and concatenation
Use:
+,-,*,/,%~for string concatenation
Example:
{{ "apple" ~ "pear" ~ "banana" }}Fallbacks and conditionals
Use:
??for null-coalescing fallbacks? :for ternary expressions
Examples:
{{ foo ?? bar ?? "default" }}{{ foo == null ? bar : baz }}{{ foo ?? bar ?? raise }}For undefined vs null behavior, see the Handling null and undefined values guide.
Operator precedence
Pebble operators are evaluated in this order:
.|%,/,*-,+==,!=,>,<,>=,<=is,is notandor
Tags
Pebble tags are enclosed in {% %} and control template flow.
Most common tags
ifforsetrawfiltermacroblock
Examples:
{% set header = "Welcome Page" %}{{ header }}{% raw %}{{ user.name }}{% endraw %}{% for user in users %} {{ user.name }}{% else %} No users found.{% endfor %}{% filter lower | title %} hello world{% endfilter %}Tests
Tests are used with is and is not.
Common tests:
definedemptyevenodditerablejsonmapnull
Examples:
{% if user.email is empty %} ...{% endif %}{% if name is not null %} ...{% endif %}When to use this page
- Need expression-writing basics: Pebble Syntax
- Need data transformations: Filter Reference
- Need runtime helpers: Function Reference
Was this page helpful?