Slick-CŪ uses the operator precedence of C. The table below contains the unary operators that an expression can use.
|
Operator |
Description |
|---|---|
|
! e1 |
Logical NOT. Result is 1 if e1 evaluates to 0. Otherwise the result is 0. |
|
~ e1 |
Bitwise complement. |
|
- e1 |
Negation. |
|
+ e1 |
No change. |
|
++ v1 |
Increments the variable v1 and returns the result. |
|
v1 ++ |
Returns the value of v1 and then increments the variable v1. |
|
-- v1 |
Decrements the variable v1 and returns the result. |
|
v1 -- |
Returns the value of v1 and then decrements the variable v1. |
The binary and ternary operators for the Slick-C language are listed in the table below. In addition to the operators listed in the previous table, string concatenation is implied. If a binary operator does not exist between two unary expressions, concatenation is automatically performed.
All numeric operators, except bitwise operators, support floating point numbers. Bitwise operators support 32-bit integers for all platforms.
Two sets of comparison operators exist. The operators <, >, =, !=, <=, and >= perform a numeric comparison if both string expressions are valid numbers. The operators :<, :>, :==, :!=, :<=, and :>= always perform a string comparison.
Select the appropriate comparison operator for performing a string or numeric comparison. Expressions may extend across line boundaries if the line ends in a binary operator or if the line ends with a backslash.
The table below shows examples of math operators in Slick-C.
|
Example |
Operator |
|---|---|
|
(1.0==1) |
== true |
|
(1e2==100) |
== true |
|
(1e2:==100) |
== false |
|
(" abc "=="abc") |
== true |
|
(" abc ":=="abc") |
== false |
|
(" abc ":!="abc") |
== true |
|
(" 1 "==1) |
== true |
|
(" 1 ":==1) |
== false |
|
("abc":<"def") |
== true |
|
1 2 |
:=="12" |
|
1 ( 2) |
:=="12" |
|
pow(4,2) |
==16 |
|
5%2 |
==1 |
|
5/2 |
==2 |
|
5/2.0 |
==2.5 |
|
5 intdiv 2.0 |
==2 |
|
5&2 |
==0 |
|
5|2 |
==7 |
|
(10<7) |
== false |
|
(10:<7) |
== true |