Skip to main content
A complete lookup of every penscript operator, organized by category. Each entry shows the operator name, what it does, and a minimal example. For full documentation and detailed examples, follow the link to the dedicated page.

Logic & conditions

→ Full reference: Logic & comparisons
OperatorDescriptionExample
:if / :then / :elseConditional branching{ ":if": "{active}", ":then": "Yes", ":else": "No" }
:case / :when / :elseSwitch-style matching{ ":case": "{status}", ":when": [["a", "Alpha"]], ":else": "Other" }
:cmpComparison with thresholds{ ":cmp": "{x}", ":gt": 0, ":lt": 100 }
:eqEquality test (all values equal){ ":eq": ["{a}", "{b}", 42] }
:distinctUniqueness test (all values different){ ":distinct": [1, 2, 3] }
:inValue exists in list{ ":in": ["{role}", ["admin", "manager"]] }
:ninValue does not exist in list{ ":nin": ["{role}", ["banned"]] }
:notBoolean negation{ ":not": "{flag}" }
:everyAll items satisfy condition{ ":every": ["{arr}", { ":cmp": "@item", ":gt": 0 }] }
:someAt least one item satisfies condition{ ":some": ["{arr}", { ":eq": ["@item", "x"] }] }

Comparison Modifiers (used with :cmp)

ModifierMeaning
:eqEqual to
:neqNot equal to
:gtGreater than
:gte / :geGreater than or equal to
:ltLess than
:lte / :leLess than or equal to

Constants

OperatorResult
:truetrue
:falsefalse
:nullnull
:undefinedundefined

Numbers

→ Full reference: Numbers & calculations
OperatorDescriptionExample
:sumAddition{ ":sum": [1, 2, 3] }6
:multiplyMultiplication{ ":multiply": [5, 3] }15
:productDecimal formatting{ ":product": [3.14, 2] }"3.14"
:divideDivision{ ":divide": [100, 4] }25
:powerExponentiation{ ":power": [2, 3] }8
:maxMaximum value from array{ ":max": [3, 7, 9, 1] }9
:minMinimum value from array{ ":min": [3, 7, 9, 1] }1
:format-numberNumber formattingWith :digits for decimal precision

Arrays & collections

→ Full reference: Loops & arrays
OperatorDescriptionExample
:arrayNormalize to array{ ":array": "x" }["x"]
:array + :fillGenerate array of length N{ ":array": 3, ":fill": "{@index}" }
:map / :toTransform each item{ ":map": [arr], ":to": expr }
:filterRemove items by conditionWraps :map with :if returning false
:findFirst matching item{ ":find": [arr, condition] }
:includesArray contains value{ ":includes": [arr, val] }
:intersectsArrays share elements{ ":intersects": [arr1, arr2] }
:countCount items{ ":count": arr } with :where / :unless
:range-arrayGenerate integer range{ ":range-array": [0, 5] }[0,1,2,3,4]
:flattenDeep flatten nested arrays{ ":flatten": [[1,[2]]] }[1,2]
:increasingStrictly increasing check{ ":increasing": [1,2,3] }true

Context Variables (available inside loops)

VariableDescription
{@item}The current item value
{@index}Current index (0, 1, 2…)
{@position}Current position (1, 2, 3…)
{@first}true if the current item is the first
{@last}true if the current item is the last

Dates & time

→ Full reference: Dates & time
OperatorDescriptionExample
:dateCreate / parse a date{ ":date": "now" }
:format-dateFormat date with patternWith :pattern: "D/M/Y"
:diffDifference between datesWith :comparator: "day"
:sum (dates)Date arithmetic{ ":sum": ["{$today}", "2d"] }

Inline Pipes (dates)

PipeDescriptionExample
| ageAge calculation"{data.birthdate | age}"34
| formatDdMmYyyyFormat as DD/MM/YYYY"{$today | formatDdMmYyyy}""27/01/2026"

Date Pattern Characters

CharacterDescription
YYear, 4 digits
yYear, 2–4 digits
MMonth, 2 digits
mMonth, 1–2 digits
DDay, 2 digits
dDay, 1–2 digits
xAny non-digit separator

Duration Units (for date arithmetic)

UnitExample
Days"2d", "30d"
Hours"72h"
Years"2y"
Raw numbers = milliseconds. Numeric strings = seconds.

Dynamic evaluation

→ Full reference: Dynamic evaluation & scope
OperatorDescriptionExample
:define / :inLocal variable scope{ ":define": [{"x": 1}], ":in": "{x}" }
:withInline local bindings{ ":with": [{"x": 1}, "{x}"] }
:rawCapture without evaluating{ ":raw": "{expr}" }
:evalEvaluate captured expression{ ":eval": "{stored_expr}" }
:usingDefine named expressionsCombined with :eval
:pipeSequential transformation{ ":pipe": [val, step1, step2] }

Internationalization

→ Full reference: Internationalization
OperatorDescriptionExample
:i18nLocale-based string{ ":i18n": { "fr": "Bonjour", "en": "Hello" } }

System variables

VariableDescription
{$today}The current date