Operators: <

Less than comparison operator.

Syntax

integer‑operand<integer‑operand

float‑operand<float‑operand

char‑operand<char‑operand

string‑operand<string‑operand

Integer is less than test

In its first version, the < operator compares two signed integer or unsigned integer operands. If the left operand is numerically less than the right operand, the operation results in the boolean value true. Otherwise, the operation will result in the value false. For example:

var int32 a = 1369; var int32 b = 1251; var int32 c = 2000; var bool result = a < b; // result = false var bool result = a < c; // result = true

Floating point is less than test

In its second version, the < operator compares two floating-point operands. If the left operand is numerically less than the right operand, the operation results in the boolean value true. Otherwise, the operation will result in the value false. For example:

var float a = 1.1369; var float b = 1.1251; var float c = 1.2; var bool result = a < b; // result = false var bool result = a < c; // result = true

Char is less than test

In its third version, the < operator compares two character operands. Please note, in Chora all characters are handled as 16-bit UNICODE entities - they are represented as 16-bit UNICODE numbers. Thus, if the character code in the left operand is numerically less than in the right operand, the operation results in the boolean value true. Otherwise, the operation will result in the value false. For example:

var char a = 'Y'; // code = 89 var char b = 'X'; // code = 88 var char c = 'y'; // code = 121 var bool result = a < b; // result = false var bool result = a < c; // result = true

String is less than test

In its fourth version, the < operator compares lexicographically two string operands. Please note, strings in Chora are composed of 16-bit UNICODE characters, which means that every character in the string is an individual 16-bit UNICODE number. In the course of this operation, the operator compares successively the character codes in the left operand with their counterparts from the right operand. If the character code in the left operand is numerically less than the code of the character in the right operand, the operation terminates with the boolean value true. If the left character code is greater than its right counterpart or all characters are equal, the operation terminates with the value false. For example:

var string a = "Cool"; var string b = "Cold"; var string b = "cold"; var bool result = a < b; // result = false var bool result = a < c; // result = true