The ≤ Command

We're glad you came by, but you might find what you're looking for elsewhere.

TI-Basic Developer is not the site it once was. While its information on commands and other calculator features remains almost second-to-none, its forum, archives, and even hosting service, Wikidot, have been decaying for years. The calculator community would love to see what you're working on, or help you in your next coding adventure, but TI-Basic Developer is no longer the place to do it.

Instead, you should head over to Cemetech (primarily American) or TI-Planet (primarily international). Both are active, well-established forums with their own archives, chatrooms, reference material, and abundant coding tools and resources. We'll see you there, we hope.

lessthanequal.png

Command Summary

Tests if one value is smaller than or equal to another.

Command Syntax

value1value 2

Menu Location

Press [♦][<] to enter ≤.

Calculator Compatibility

This command works on all calculators.

Token Size

1 byte

The ≤ operator compares two values, returning true if the right side is greater or if the two are equal, and false otherwise. It is a basic building block of the conditions used by commands such as If, when(), and While. The results of ≤ and the other relational operators (=, , >, , and <) can be combined with the and, or, xor, and not operators to create more complicated conditions.

It returns a single value for most types of data, and returns false if the two sides are mismatched in type: comparing a single number to a list, for instance, or comparing two lists that are of a different size. The only exception is when comparing two lists or two matrices of the same size: in that case, it compares them element-by-element, and returns a list or matrix of true/false values.

:3≤4
 true
:3≤2
 false
:{1,2,3}≤{3,2,1}
 {true true false}

If either side or both contains undefined variables, ≤ will wait to return a value. You can do math with the resulting inequality, and if an operation makes sense, it will be applied to both sides: for instance, if x≤y, then you can negate it to get -x≥-y. An operation will not be applied to both sides if it wouldn't be consistent with the previous inequality: for example, you can't square both sides, since even if x≤y the comparison between x^2 and y^2 could go in any order. You can also extract the two halves of the inequality with left() and right().

Advanced Uses

The ≤ operator can also compare strings. It does so by comparing the character codes of each character, and orders the strings by the first difference it finds. This ideally means that the strings are ordered by dictionary order: for example, "aardvark"≤"apple", since it would come later in the dictionary.

However, the problem is that all uppercase letters have a smaller character code than lowercase letters, so this only holds true if the strings are the same case. Otherwise, strange results can happen: for instance, "Apple"≤"aardvark", since "A" comes before "a".

Related Commands

  • = (equal)
  • (not equal)
  • > (greater than)
  • (greater than or equal)
  • < (less than)

See Also

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).
Notify administrators if there is objectionable content in this page.
Something does not work as expected? Find out what you can do.
General Wikidot.com documentation and help section.
Wikidot.com Terms of Service - what you can, what you should not etc.
Wikidot.com Privacy Policy.

AltStyle によって変換されたページ (->オリジナル) /