Standard Operators

Parent Previous Next

VisualSim                                                                                                                                    

Standard Operators

 

Type

 

Operators

 

Data Type

 

Arithmetic

+, -, *, /, ^, and %

Int, double, long, arrays, data structure fields and matrices

Bitwise

Following are the bitwise operators:

& is bitwise AND

~ is bitwise NOT

| is bitwise OR

# is bitwise XOR (exclusive OR)

&, |, #, and ~

Boolean, unsignedByte, int and long (but not fixedpoint, double or complex)

Boolean Expression

boolean ? value1 : value2

If the Boolean is true, value of the expression is value1; otherwise, it is value2.

Logical

Note: The difference between logical && and logical & is that & evaluates all the operands regardless of whether their value is now irrelevant. Similarly for logical || and |. Thus, for example, the expression "false && x" will evaluate to false irrespective of whether x is defined. On the other hand, "false & x" will throw an exception. The << and >> operators performs arithmetic left & right shifts respectively. The >>> operator performs logical right shift, which does not preserve the sign. They operate on unsignedByte, int and long.

&&, ||, !, &, |, << and >>

Operate on type Boolean and return type Boolean

Relational

<, <=, >, >=, == and !=

Return type Boolean

 

 

Created with the Personal Edition of HelpNDoc: Produce electronic books easily