The left() 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.

left.png

Command Summary

Returns a subsection from the left of a list or string, or the left hand side of an equation.

Command Syntax

left(equation)
left(list-or-string,length)

Menu Location

  • Press 2nd MATH to enter the MATH popup menu.
  • Press 3 to enter the List submenu.
  • Press 9 to select left(.

Calculator Compatibility

This command works on all calculators.

Token Size

2 bytes

When applied to a list or a string, left(x,length) gets the first length elements/characters of x. This is an alternative to mid(), which will do the same thing from any point in the list or string, not just the beginning.

When applied to an equation (such as x=5) or an inequality (such as x<3), left() returns the left-hand side of the equation. This only works for equations that don't get simplified: left(2+2=4) will not work, because 2+2=4 will return 'true' first.

:left({1,2,3,4,5},3)
           {1  2  3}
:left("TI-Basic Developer",8)
           "TI-Basic"
:left(x^2+2x+1>0)
           x^2+2*x+1
:left({1,2,3,4,5},0)
           {}

Optimization

Use left() instead of mid() when the substring starts at the beginning of the list or string.

Error Conditions

260 - Domain error happens when the argument is not a list, string, or equation, or is an equation that has simplified.

Related Commands

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.