Array types operators
Index operator
Access array elements by indices or logical values.
See index operator.
[ ] | 1d indexing | array1d = [1,2,3] |
2d indexing | array2d = [1,2;3,4] |
Colon operator
Create a sequence of float values.
See colon operator.
: | Binary | [1:5] // [1,2,3,4,5] |
Ternary | [1:2:5] // [1,3,5] |
Equality operators
Check float[], bool[] or string[] for equality.
Two arrays are equal if they have equal dimensions and equal elements.
Return type: bool
== | Equality | [1,2] == [1,2] // true |
!= | Inequality | [1,2] != [1;2] // true |
Relational operators
Compare float[] or string[].
Two arrays are element-wise compared, row by row. If an element is less, the respective array is less. If the first rows are equal, the array with less columns is less. Otherwise the array with less rows is less.
Return type: bool
< | Less | [1,2] < [1,3] // true |
<= | Less or equal | [1,2] <= [1,2] // true |
> | Greater | [1,3] > [1,2] // true |
>= | Greater or equal | [1,2,3] >= [1,2] // true |
String concatenation operators
Concatenate string with string[], float[] or bool[].
Return type: string
+ | String-string[] concatenation | a = "array: " + ["element"] |
String-float[] concatenation | a = "array:\n" + [1,2;3,4] |
|
String-boolean[] concatenation | a = "array: " + [true,true] |
Element-wise array operators
Element-wise operators have a preceeding dot. They perform the operator on each element and return the results in an array with the same dimensions as the input array(s). The dimensions of two arrays must be equal.
Logical operators
Element-wise logical operations on bool[].
Return type: bool[]
.! | Negation | .![true,false] // [false,true] |
.|| | Logical Or | [true,false] .|| true // [true,true] |
.&& | Logical And | [false;true] .&& true // [false;true] |
Arithmetic operators
Element-wise arithmetic operations on float[].
Return type: float[]
.+ | Plus | [1,2] .+ 1 // [2,3] |
Unary plus | .+[1,2] // [1,2] |
|
.- | Minus | [1,2;3,4] .- 1 // [0,1;2,3] |
Unary minus | .-[1;2] // [-1;-2] |
|
.* | Multiplication | [4,2] .* 2.5 // [10,5] |
./ | Division | [4;3] ./ 2 // [2;1.5] |
.% | Modulus (remainder) | [8;-5;0] .% 3 // [2;-2;0] |
Equality operators
Element-wise check float[], bool[] or string[] for equality.
Return type: bool[]
.== | Equality | 1 .== [1,2] // [true,false] |
.!= | Inequality | [1,1;2,2] .!= [1,2;1,2] // [false,true;true,false] |
Relational operators
Element-wise compare float[] or string[].
Return type: bool[]
.< | Less | 1 .< [1,2] // [false,true] |
.<= | Less or equal | 1 .<= [1,2] // [true,true] |
.> | Greater | [1,2;3,4] .> [1,1;3,3] // [false,true;false,true] |
.>= | Greater or equal | [1;2;3] .>= [2;2;2] // [false;true;true] |
String concatenation operators
Element-wise concatenate string, string[] with string[], float[], bool[] or string[] with string, float, bool.
Return type: string[]
.+ | String-string concatenation | ["a","b"] .+ "c" // ["ac","bc"] |
String-float concatenation | ["a","b"] .+ 1 // ["a1","b1"] |
|
String-boolean concatenation | [true;false] .+ "a" // ["truea";"falsea"] |
Related
- Simple types operators
- array initialization function
- index operator
- colon operator
Copyright ©2008-2024 Esri R&D Center Zurich. All rights reserved.