Vikari Language Documentation


Available since:  v0.8.0.

Equality Operators

Vikari features the following binary operators for testing equality of expressions:

Operator NameSymbolFunction
Equals=Check that the two expressions are equal.
Not Equals'=Check that the two expressions are not equal.

The result of an equality expression is a Boolean value of true or false. Any two expressions returning an AtonementCrystal can be compared. Meaning any combination of Value literals or other types.

Examples

The following demonstrates usage of the equals operator.

~:Compare two numbers.:~
int:Integer << 2
:[int = 2]: ~:Prints "true".:~

float:Float << 3.14
:[float = 6.28]: ~:Prints "false".:~

~:Any expression can be compared.:~
:[6.28 / 2] = [3 + 0.14]: ~:Prints "true".:~

~:Logical expressions can be compared too.:~
bar:Boolean << true
:[bar ^ true] = [bar " false]: ~:Prints "true.:~

~:Variables of differing types can be compared.:~
:[22 = true]: ~:Prints "false".:~

~:Test if a value is null by comparing to the null keyword.:~
:[foo = null] ~:Prints "false".:~

The following demonstrates usage of the not equals operator.

~:Compare two numbers.:~
int:Integer << 2
:[int '= 2]: ~:Prints "false".:~

float:Float << 3.14
:[float '= 6.28]: ~:Prints "true".:~

~:Any expression can be compared.:~
:[6.28 / 2] '= [3 + 0.14]: ~:Prints "false".:~

~:Logical expressions can be compared too.:~
bar:Boolean << true
:[bar ^ true] '= [bar " false]: ~:Prints "false.:~

~:Variables of differing types can be compared.:~
:[22 '= true]: ~:Prints "true".:~

~:Test if a value is not null by comparing to the null keyword.:~
:[foo '= null] ~:Prints "true".:~