Operators - markpwns1/Dormez GitHub Wiki

All the standard operators (except bit manipulation) exist in Dormez.

=

In Dormez, assignment returns a value, so things like this are possible:

x = y = z = 5;

All their values will be 5.

?

The ? operator also exists in Dormez. Refer to the following example:

declare x = anyBoolean? 5 else 6;

If anyBoolean were true, x would be assigned to 5, otherwise it would be assigned to 6.

or

The or operator also has special behaviour, besides simply being a normal or operator. See the following examples:

console.print(true or false); // returns true, as expected

This is it behaving like a standard or operator. However, when object to the left is undefined, it will return the right object. Observe:

// toNumber() returns undefined if it was unsuccessful
declare number = console.prompt().toNumber(); 

console.log(number or "Invalid input!"); 

This code will either print out the number you typed in, or print out Invalid input!

^

The ^ is the exponent operator.

console.print(7^3); // prints "343"