Skip to main content
About the Resource Center

Script arithmetic operators and functions

You can use a variety of arithmetic operators and functions in dynamic variable expressions. To override the default precedence of operators, use parentheses. Operators include:

OperatorNameSyntax
(, )Parentheses(x)
[, ]Matrix, Index[…]
,Parameter separatorx, y
;Statement separatorx; y
;Row separator[x, y]
\nStatement separatorx \n y
+Addx + y
+Unary plus+y
Subtractx – y
Unary minus-y
*Multiplyx * y
.*Element-wise multiplyx .* y
/Dividex / y
./Element-wise dividex ./ y
%, modModulusx % y
^Powerx ^ y
.^Element-wise powerx .^ y
Transposey’
!Factorialy!
&Bitwise andx & y
~Bitwise not~x
|Bitwise orx | y
^|Bitwise xorx ^| y
<<Left shiftx << y
>>Right arithmetic shiftx >> y
>>>Right logical shiftx >>> y
andLogical andx and y
notLogical notnot y
orLogical orx or y
xorLogical xorx xor y
=Assignmentx = y
? :Conditional expressionx ? y : z
:Rangex : y
to, inUnit conversionx to y
==Equalx == y
!=Unequalx != y
<Smallerx < y
>Largerx > y
<=Smallereqx<= y
>=Largereqx >= y