Loading

==

operators math

Tests if both parameters are equal.

The == operator consumes two parameters from the top of the stack and pushes onto the stack true if they are equal, false otherwise.

The two parameters must be of numeric, boolean, vector, matrix or string types. For vector or matrix, the parameters must be the same size.

Since 2.1.0, as every other comparison operators, == can also be used between two GTS or a GTS and a constant.

$gts 42 == is strictly equivalent of a 42 mapper.eq MAP operation, with a simplified syntax.

Since 2.1.1, == can be use to check equality between Lists, Maps and Sets. For for details about how this is defined, check the java documentation.

== is available since version 1.0.0.

See also

Signatures

Examples

// // Testing numbers equality // 10 10 == // true 10.0 10 == // true 10.9 10.9 == // true 5 45.4 == // false //Best practice is to use ISNaN function, but this syntax is also legal: NaN NaN == //true ( This is WarpScript specific, it does not comply to IEEE 754 )
// // Testing strings equality // "Hello" "World" == // false "Hello" "Hello" == // true
// // Testing booleans equality // false true == // false true true == // true
// // Testing vectors equality // [ 1 2 ] ->VEC 'vector1' STORE [ 1 2.0 ] ->VEC 'vector2' STORE [ 1 2 3 ] ->VEC 'vector3' STORE [ 1 2 6 ] ->VEC 'vector4' STORE $vector1 $vector2 == // true $vector3 $vector4 == // false
// // Testing matrices equality // [ [ 1 2 ] [ 3 4 ] ] ->MAT 'matrix1' STORE [ [ 1.0 2.0 ] [ 3.0 4.0 ] ] ->MAT 'matrix2' STORE [ [ 1 2 3 ] [ 1 2 3 ] ] ->MAT 'matrix3' STORE [ [ 1 2 3 ] [ 1 7 3 ] ] ->MAT 'matrix4' STORE $matrix1 $matrix2 == // true $matrix3 $matrix4 == // false