 Operators: <=

Less than or equal comparison operator.

Syntax

integer‑operand<=integer‑operand

float‑operand<=float‑operand

char‑operand<=char‑operand

string‑operand<=string‑operand

Integer is less than or equal test

In its first version, the <= operator compares two signed integer or unsigned integer operands. If the left operand is numerically less than or equal to 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 int32 d = 1369;

var bool result = a <= b; // result = false
var bool result = a <= c; // result = true
var bool result = a <= d; // result = true

Floating point is less than or equal test

In its second version, the <= operator compares two floating-point operands. If the left operand is numerically less than or equal to 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 float d = 1.1369;

var bool result = a <= b; // result = false
var bool result = a <= c; // result = true
var bool result = a <= d; // result = true

Char is less than or equal 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 or equal to the code 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 char d = 'Y';  // code = 89

var bool result = a <= b; // result = false
var bool result = a <= c; // result = true
var bool result = a <= d; // result = true

String is less than or equal 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 greater than the code of the character in the right operand, the operation terminates with the boolean value false. If the left character code is less than its right counterpart or all characters area equal, the operation terminates with the value true. For example:

var string a = "Cool";
var string b = "Cold";
var string b = "cold";
var string d = "Cool";

var bool result = a <= b; // result = false
var bool result = a <= c; // result = true
var bool result = a <= d; // result = true