Skip to main content

Expressions

Expressions let you write dynamic logic — calculations, comparisons, and string manipulation.


What Are Expressions?

Expressions are mini-formulas that compute values:

var.balance + 100          → adds 100 to balance
user.first_name + " Smith" → combines strings
var.age >= 18 → checks if adult

Where to Use Expressions

Expressions work in:

PlaceExample
Condition nodesvar.balance > 0
Transform nodesvalue * 2
Text templates{{var.balance + 10}}
Validationvalue >= 18 && value <= 100

Basic Math

OperationSymbolExampleResult
Add+5 + 38
Subtract-10 - 46
Multiply*6 * 742
Divide/20 / 45
Remainder%17 % 52

Comparisons

ComparisonSymbolExampleResult
Equals==5 == 5true
Not equals!=5 != 3true
Greater than>10 > 5true
Less than<3 < 5true
Greater or equal>=5 >= 5true
Less or equal<=4 <= 5true

Logic (And/Or/Not)

OperationSymbolExampleResult
And&&true && falsefalse
Or||true || falsetrue
Not!!truefalse

Combining Conditions

var.age >= 18 && var.is_verified

Both must be true.

var.role == "admin" || var.role == "moderator"

Either can be true.


Working with Text

Combining Strings

"Hello, " + user.first_name + "!"
→ "Hello, Alice!"

Useful Functions

FunctionWhat It DoesExample
len(x)Lengthlen("hello")5
upper(x)Uppercaseupper("hello")"HELLO"
lower(x)Lowercaselower("HELLO")"hello"
trim(x)Remove whitespacetrim(" hi ")"hi"
contains(x, y)Has substring?contains("hello", "ell")true

Working with Numbers

FunctionWhat It DoesExample
int(x)Convert to integerint("42")42
float(x)Convert to decimalfloat("3.14")3.14
abs(x)Absolute valueabs(-5)5
min(a, b)Smaller valuemin(5, 3)3
max(a, b)Larger valuemax(5, 3)5

Working with Lists

FunctionWhat It DoesExample
len(arr)Count itemslen([1,2,3])3
first(arr)First itemfirst([1,2,3])1
last(arr)Last itemlast([1,2,3])3
join(arr, sep)Combine to stringjoin(["a","b"], "-")"a-b"

The Ternary Operator

A quick if/else in one line:

condition ? value_if_true : value_if_false

Examples:

var.age >= 18 ? "Adult" : "Minor"

var.balance > 0 ? var.balance : 0

Template Expressions

Inside text, use {{...}}:

Hello {{user.first_name}}!
Your balance: ${{var.balance}}
Status: {{var.is_active ? "Active" : "Inactive"}}

Common Patterns

Calculate Discount

var.total * (1 - var.discount_rate)

Format Currency

"$" + string(var.balance)

Check Empty

var.email != "" && var.email != nil

Safe Division

var.count > 0 ? var.total / var.count : 0

Tips

Start Simple

Get basic expressions working first, then add complexity.

Test Your Logic

Use a Send Message node to show expression results during development:

Debug: {{var.age >= 18}}
Type Matters

"5" (text) is different from 5 (number). Use int() or float() to convert.


Quick Reference

Common Checks

PurposeExpression
Is registered?var.registered == true
Has balance?var.balance > 0
Is admin?user.id == 12345
Text not empty?len(var.name) > 0
Contains word?contains(input, "help")

Next Steps