Scripting:Operators

From STNE Wiki

(Difference between revisions)
Jump to: navigation, search
Line 16: Line 16:
! Operator name !! Syntax
! Operator name !! Syntax
|-
|-
-
| Equal to      || a = b
+
| Equals                  || a = b
|-
|-
-
| Not equal to  || a <> b
+
| References equal         || a Is b
|-
|-
-
| Greather than  || a > b
+
| Not equal to            || a <> b
|-
|-
-
| Less than     || a < b
+
| Greater than             || a > b
|-
|-
-
| Greather than or equal to || a >= b
+
| Less than               || a < b
|-
|-
-
| Less than or equal to     || a <= b
+
| Greater than or equal to || a >= b
|-
|-
-
| Reference equal to       || a Is b
+
| Less than or equal to   || a <= b
|}
|}
Line 84: Line 84:
== Notes ==
== Notes ==
-
* The {{code | assignment}} operator and the {{code | equal to}} operator use the same symbol. It depends on the context which operator is used. The {{code | assignment}} operator is used when a line of code follows this syntax: {{code | Identifier {{=}} Value;}}. In all other cases, the {{code | equal to}} operator is used
+
=== Assignment operator v.s. equals operator
 +
The {{code | assignment}} operator and the {{code | equals}} operator use the same symbol. It depends on the context which operator is used. The {{code | assignment}} operator is used when a line of code follows this syntax: {{code | Identifier {{=}} Value;}}. In all other cases, the {{code | equals}} operator is used.
 +
 
 +
=== References equal ===
 +
The {{code | References equal}} operator returns true if both identifiers hold the same reference (or: point to the same object).
 +
 
 +
For example:
 +
  Var i As String = "a";
 +
  Var j As String = "a";
 +
  WriteLine(i Is j); // false
 +
 +
  i = j;
 +
  WriteLine(i Is j); // true

Revision as of 16:07, 10 September 2010

Contents

Table

In this section, a and b represent either literal values, object references or expressions evaluating to the appropriate type.

String operators

Operator name Syntax
Concatenation a & b


Comparison operators

Operator name Syntax
Equals a = b
References equal a Is b
Not equal to a <> b
Greater than a > b
Less than a < b
Greater than or equal to a >= b
Less than or equal to a <= b


Arithmetic operators

Operator name Syntax
Assignment a = b
Addition a + b
Subtraction a - b
Multiplication a * b
Division a / b
Increment a++
Increment ++a
Decrement a--
Decrement --a


Logical operators

Operator name Syntax
Logical NOT NOT a
Logical AND a AND b
Logical OR a OR b


Other operators

Operator name Syntax
Function call a()
Function reference AddressOf a
Member b of a a.b

Notes

=== Assignment operator v.s. equals operator The assignment operator and the equals operator use the same symbol. It depends on the context which operator is used. The assignment operator is used when a line of code follows this syntax: Identifier = Value;. In all other cases, the equals operator is used.

References equal

The References equal operator returns true if both identifiers hold the same reference (or: point to the same object).

For example:

 Var i As String = "a";
 Var j As String = "a";
 WriteLine(i Is j); // false

 i = j;
 WriteLine(i Is j); // true
Personal tools