Documentation Index Fetch the complete documentation index at: https://docs.penbox.io/llms.txt
Use this file to discover all available pages before exploring further.
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
Operator Description Example :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)
Modifier Meaning :eqEqual to :neqNot equal to :gtGreater than :gte / :geGreater than or equal to :ltLess than :lte / :leLess than or equal to
Constants
Operator Result :truetrue:falsefalse:nullnull:undefinedundefined
Numbers
→ Full reference: Numbers & calculations
Operator Description Example :sumAddition { ":sum": [1, 2, 3] } → 6:substractSubtraction { ":substract": [100, 30] } → 70:productMultiplication { ":product": [5, 3] } → 15:multiplyMultiplication (alias) { ":multiply": [5, 3] } → 15: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:to-fixedFixed decimal places { ":to-fixed": 123.456, ":digits": 1 } → "123.5":numberCoerce to number { ":number": "123" } → 123:format-numberNumber formatting With :digits for decimal precision
Arrays & collections
→ Full reference: Loops & arrays
Operator Description Example :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 condition Wraps :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)
Variable Description {@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
Operator Description Example :dateCreate / parse a date { ":date": "now" }:format-dateFormat date with pattern With :pattern: "D/M/Y" :diffDifference between dates With :comparator: "day" :sum (dates)Date arithmetic { ":sum": ["{$today}", "2d"] }
Inline Pipes (dates)
Pipe Description Example | ageAge calculation "{data.birthdate | age}" → 34| formatDdMmYyyyFormat as DD/MM/YYYY "{$today | formatDdMmYyyy}" → "27/01/2026"
Date Pattern Characters
Character Description 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)
Unit Example Days "2d", "30d"Hours "72h"Years "2y"
Raw numbers = milliseconds. Numeric strings = seconds.
Dynamic evaluation
→ Full reference: Dynamic evaluation & scope
Operator Description Example :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 expressions Combined with :eval :pipeSequential transformation { ":pipe": [val, step1, step2] }
Internationalization
→ Full reference: Internationalization
Operator Description Example :i18nLocale-based string { ":i18n": { "fr": "Bonjour", "en": "Hello" } }
System variables
Variable Description {$today}The current date
What is penscript Introduction to penscript
How penscript works Expression modes and composition