7. Leading signs

Description

There are three leading signs in DestinyScript totally: two arithmetical (Plus and Minus) as soon as a binary (NOT). Please notice that every sign must be directly at the beginning of each values/scopes/parentheses. The data types switch and string cannot be used with leading signs.

Plus sign

Description

The plus sign has only been introduced to make it easier to copy numbers. It doesn't change the number. The plus sign (+) is used for this leading sign.
 
Sign
+

Example

1
2
$
v[1] = 0 + +1
The variable no. 1 whould be 1 at the end.

Minus sign

Description

You can define negative numbers by using the minus sign (if you use an integer value the two's complement will be formed). The minus sign (-) is used for this leading sign.
 
Sign
-

Example

1
2
3
$
v[1] = 5 + -3;
v[2] = 10 - -11
The variable no. 1 whould be 2 at the end and variable no. 2 whould be 21.
Information
The mathematical law "minus minus is plus" is used here, too.

NOT sign

Description

You can negate a value with the NOT sign (the ones' complement will be formed). The tilde sign (~) is used for this leading sign. This leading sign can't be used with doubles.
 
Sign
~

Example

1
2
$
v[1] = ~100
The variable no. 1 whould be -101 at the end.
Information
According to the boolean algebra is not not the same as the value without any not sign before it (= Identity)!