Skip to content

Operator <= (Less than or Equal)


Compares an expression less than or equal to another expression

Syntax

vb
declare operator <= ( byref lhs as byte, byref rhs as byte ) as integer
declare operator <= ( byref lhs as ubyte, byref rhs as ubyte ) as integer
declare operator <= ( byref lhs as short, byref rhs as short ) as integer
declare operator <= ( byref lhs as ushort, byref rhs as ushort ) as integer
declare operator <= ( byref lhs as integer, byref rhs as integer ) as integer
declare operator <= ( byref lhs as uinteger, byref rhs as uinteger ) as integer
declare operator <= ( byref lhs as longint, byref rhs as longint ) as integer
declare operator <= ( byref lhs as ulongint, byref rhs as ulongint ) as integer

declare operator <= ( byref lhs as single, byref rhs as single ) as integer
declare operator <= ( byref lhs as double, byref rhs as double ) as integer

declare operator <= ( byref lhs as string, byref rhs as string ) as integer
declare operator <= ( byref lhs as zstring, byref rhs as zstring ) as integer
declare operator <= ( byref lhs as wstring, byref rhs as wstring ) as integer

declare operator <= ( byref lhs as T, byref rhs as T ) as integer

Usage

` result = lhs <= rhs

`

Parameters

lhs

The left-hand side expression to compare to.

rhs

The right-hand side expression to compare to.

T

Any pointer type.

Return Value

Returns negative one (-1) if the left-hand side expression is less than or equal to the right-hand side expression, or zero (0) if greater than.

Description

Operator <= (Less than or Equal) is a binary operator that compares an expression less than or equal to another expression and returns the result - a boolean value in the form of an Integer: negative one (-1) for true and zero (0) for false. The arguments are not modified in any way.

When this operator is applied to string type data, then a lexicographic/alphabetic order comparison is performed (ordered from the numeric ASCII values of the characters of the two strings).

This operator can be overloaded to accept user-defined types as well.

Examples

Operator > (Greater than) is complement to Operator <= (Less than or Equal), and is functionally identical when combined with Operator Not (Bit-wise Complement).

start GeSHi

vb
   If (69 <= 420) Then Print "(69 <= 420) is true."
   If Not (60 > 420) Then Print "not (420 > 69) is true."

end GeSHi

Dialect Differences

  • In the -lang qb dialect, this operator cannot be overloaded.

Differences from QB

  • none

See also

  • Operator > (Greater than)

Back to DocToc

Translated from FreeBASIC official docs. Contact us for removal if infringed.
FreeBASIC is an open-source project, not affiliated with Microsoft