{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Journeys","product":"Identity Management","type":"markdown"},"seo":{"title":"Expressions: Operators","description":"Everything about Mosaic Journeys, SDKs, and APIs","siteUrl":"https://developer.transmitsecurity.com/","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"expressions-operators","__idx":0},"children":["Expressions: Operators"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Operators can be used to perform basic computations in expressions. Most operators take two expressions as arguments (also called operands), make a computation based on the expressions, and return the result."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Operators are invoked in expressions using the following syntax, where ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["expr1"]}," and ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["expr2"]}," are expressions, and ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["operator"]}," is the operator to invoke."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"expr1 operator expr2\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"precedence","__idx":1},"children":["Precedence"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Operator invocations can be composed into bigger expressions, where different operators have different precedence levels. This means that in a chain of operator invocations (e.g., ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["expr1"]}," ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["operator1"]}," ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["expr2 operator2 expr3"]},"), the order of operator invocation is not necessarily the syntactical order."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example, the multiplication operator ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["*"]}," has a higher precedence than the addition operator ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["+"]},", so the expression ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1+2*3"]}," will actually be executed as first computing ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2*3=6"]},", and then adding the result to 1—rather than the syntactical order which would be computing 1+2 and then multiplying by 3. Parenthesis can be used to override precedence rules. For example, the expression ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["(1+2)*3"]}," will be computed by first computing 1+2 and then multiplying the result by 3."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"supported-operators","__idx":2},"children":["Supported operators"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These operators are supported in expressions (shown here in descending order of precedence):"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"center","data-label":"Precedence"},"children":["Precedence"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"center","data-label":"Operator"},"children":["Operator"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["11"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["-"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unary minus"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["11"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["!"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unary negation"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["11"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["~"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unary bitwise negation"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["10"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["/"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Divide; 10 / 2 = 5"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["10"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["*"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Multiply; 3 * 2 = 6 or \"a\" * 3 = \"aaa\""]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["10"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["%"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Modulo; 10 % 3 = 1"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["9"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["+"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Add; 10 + 2 = 12; \"hello\" + \"world\" = \"hello world\""]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["9"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["-"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Subtract; 10 - 2 = 8 (shift ones)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["8"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["<<"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Bitwise 'shift left'"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["8"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":[">>"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Bitwise 'shift right'"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["7"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":[">="]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Greater than or Equal; 10>=2 = true, 2>=10 = false, 10<=10 = true"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["7"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["<="]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Less than or Equal; 10<=2 = false, 2<=10 = true, 10<=10 = true"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["7"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":[">"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Greater than; 10>2 = true, 2>10 = false"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["7"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["<"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Less than; 10<2 = false, 2<10 = true"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["6"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["=="]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Equals; 10==10 = true; 9==10 = false; \"hello\"==\"hello\" = true"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["6"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["!="]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Not equals; 3!=2 = true; \"hello\"!=\"hello\" = false"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["5"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["&"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Bitwise 'and'"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["4"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["^"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Bitwise 'xor'"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["3"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["|"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Bitwise 'or'"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["2"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["&&"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Logical and; see notes."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["1"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["||"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Logical or; see notes"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"boolean-operators","__idx":3},"children":["Boolean Operators"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The operators ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["&&"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["||"]}," have the special property that they control evaluation flow. For all other operators, both operands of the operator are always evaluated. However for these two operators, this is not the case. Their computation is executed as follows:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["&&"]}," operator first evaluates the left operand. If its ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["truth-value"]}," is false, then false returned; the right operand will not be evaluated in this case. If the truth-value of the left operand is true, then the right operand is evaluated and its value is returned."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["||"]}," operator first evaluates the left operand. If its ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["truth-value"]}," is true, then the left operand's value is returned; the right operand will not be evaluated in this case. If the truth-value of the left operand is false, then the right operand is evaluated and its value is returned."]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Using the short-circuiting Boolean operators, expressions can be written to guard against error cases."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example, the expression ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["(maybeObject && maybeObject.maybeField) || defaultValue"]}," will return the value of field ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["maybeField"]}," of object ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["maybeObject"]}," if ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["maybeObject"]}," is a non-null value. Otherwise, ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["defaultValue"]}," will be returned. Notice that if ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["maybeObject"]}," is a null object, ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["maybeObject.maybeField"]}," doesn't even get evaluated (if it would have, then the evaluation would have terminated with an error)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"ternary-operators","__idx":4},"children":["Ternary Operators"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An expression of the form:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"cond ? trueExpr : falseExpr\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["where ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["cond"]},", ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["trueExpr"]}," and ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["falseExpr"]}," are all expressions, is evaluated as follows. First the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["cond"]}," expression is evaluated. Depending on its result's ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["truth-value"]},", either the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["trueExpr"]}," or ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["falseExpr"]}," expression is evaluated and the resulting value is returned. Note that only one of these expressions is evaluated so even if the other one would have returned an error if it were evaluated—this does not impact the expression result."]}]},"headings":[{"value":"Expressions: Operators","id":"expressions-operators","depth":1},{"value":"Precedence","id":"precedence","depth":2},{"value":"Supported operators","id":"supported-operators","depth":2},{"value":"Boolean Operators","id":"boolean-operators","depth":2},{"value":"Ternary Operators","id":"ternary-operators","depth":2}],"frontmatter":{"showNextButton":true,"showPrevButton":true,"seo":{"title":"Expressions: Operators"}},"lastModified":"2025-11-18T16:48:04.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/orchestration/getting-started/expressions/operators","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}