HadesLang Doc
Search…
Comparison and equality

Comparison

We can compare values using C style comparison operators:
1
less < than
2
lessThan <= orEqual
3
greater > than
4
greaterThan >= orEqual
Copied!

Equality

Of same types

We can test two values for equality:

Example

1
1 == 2 //false
2
"2" is "2" //true
Copied!
And for inequality:

Example

1
1 not 2 //true
2
"2" != "2" //false
Copied!

Of different types

We can test different types for equality (which will, by default, always evaluate to false).

Example

1
314 == "pi" // false
2
123 is "123" // false
Copied!
And for inequality (which will, by default, always evaluate to true).

Example

1
314 not "pi" // true
2
123 != "123" // true
Copied!

Checking type

In Hades, the equality operator also works as a typecheck. You can check any value against a proto or type. The operation will return true if the value is an instance of said proto.

Example

1
123 == int // true
2
3
var v = VideoStream("bigbuckbunny.mp4")
4
v is Vector // false
Copied!
Last modified 2yr ago