Operators
Operator Precedence (low to high)
Section titled “Operator Precedence (low to high)”pipe— Pipelineor— Logical ORand— Logical ANDeq/ne/is/instanceof— Equality / Type checklt/gt/le/ge— Comparisonadd/sub— Addition / Subtractionmul/div/mod— Multiplication / Division / Modulo- Unary:
not/neg/typeof/await/delete/new - Postfix:
.access /[args]call /ascast - Primary: literals, identifiers, brackets
Pipeline
Section titled “Pipeline”data pipe filterdata pipe filter pipe mapdata pipe transform[extra-arg]data pipe .method[arg]Compiles to:
filter(data)map(filter(data))transform(data, extraArg)data.method(arg)Assignment
Section titled “Assignment”const x be 42let y be 10y be 20Arithmetic
Section titled “Arithmetic”a add b -- a + ba sub b -- a - ba mul b -- a * ba div b -- a / ba mod b -- a % bneg x -- -xComparison
Section titled “Comparison”eq and is are interchangeable. When the right side is a type name (e.g., string, number, null, or a capitalized class name), it becomes a type check. Otherwise, it becomes a strict equality comparison (===).
a eq b -- a === ba ne b -- a !== ba lt b -- a < ba gt b -- a > ba le b -- a <= ba ge b -- a >= b
-- eq and is can be used interchangeablya eq b -- a === b (value comparison)a is b -- a === b (value comparison)a eq string -- typeof a === "string" (type check)a is string -- typeof a === "string" (type check)Logical
Section titled “Logical”a and b -- a && ba or b -- a || bnot x -- !xType Checks
Section titled “Type Checks”eq and is both work for type checks when followed by a type name.
x is string -- typeof x === "string"x eq string -- typeof x === "string"x is null -- x === nullx is MyClass -- x instanceof MyClassx instanceof Y -- x instanceof Ytypeof x -- typeof x