Operators

Arithmetic Operators

Expression
Name
Precedence

+ x

unary positve

999

- x

unary negative

999

x + y

binary addition

702

x - y

binary subtraction

702

x * y

binary multiplication

703

x × y

binary multiplication

703

x / y

binary division

703

x ÷ y

binary division

703

x ^ y

power

704

x % y

modulo

703

Bitwise Operators

Expression
Name
Precedence

~ x

bitwise NOT

999

x & y

bitwise AND

303

x ⊻ y

bitwise XOR

302

x ⊼ y

bitwise NAND

302

x ⊽ y

bitwise NOR

302

x | y

bitwise OR

301

shl(x, y)

bitwise left shift

701

shr(x, y)

bitwise right shift

701

Operators for bitwise XOR, NAND, NOR are derived from Julia, they can be renamed to whatever you want in Styio. Since the opretors are not on most keyboards, it is strongly recommended to rename them as the following:

Expression
After Renaming

x ⊻ y

x XOR y

x ⊼ y

x NAND y

x ⊽ y

x NOR y

Traditional operators of bitwise left shift (<<) and right shift (>>) operations conflict with the iteration operator (>>) of Styio. Therefore, we use function as substitution. They are defined in the "bitwise" library, and are treated the same as other bitwise operators ( ~, &, |, ...).

@<bitwise>

a = 4, b = 1
left_shift = shl(a, b)
right_shift = shr(a, b)

x ⊻ y

xor(x, y)

x ⊼ y

nand(x, y)

x ⊽ y

nor(x, y)

shl(x, y)

shr(x, y)

Logic Operators

Expression
Name
Precedence

~ x

logical NOT

999

x && y

logical AND

203

x ⊕ y

logical XOR

202

x || y

logical OR

201

Last updated