TI-BASIC:toString

From Learn @ Cemetech
Revision as of 00:56, 27 November 2017 by Battlesquid (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

ToString.png

Command Summary

Returns the string representation of the value of the input.

Command Syntax

toString(value)

Menu Location

This command is found only in the Catalog. Press:

  1. 2ND CATALOG to enter the catalog
  2. T to go to commands starting with T
  3. Scroll down to toString(

Calculator Compatibility

TI-84+ CE OS 5.2

Token Size

2 bytes

The toString( command, given any value including real numbers, complex numbers, lists, or matrices, returns the string representation of the value of the input.

 :toString(1337       //returns "1337"
 :toString({1,2,3}    //returns "{1,2,3}"
 :toString([[1,2][3,4]]   //returns "[[1,2][3,4]]"
 :toString(√-1     //returns imaginary number "i" 

toString( has less limitations than the eval( command. It can handle lists, matrices, and complex numbers. Another difference from eval( is that toString( is affected by display mode changes like Fix.

toString( replaces the old number-to-string routine previously used prior to OS 5.2.

Error Conditions

  • ERR:DATA TYPE is thrown when the input is a string.
  • ERR:NONREAL ANSWERS is thrown when the input is a complex number and your calculator is in REAL mode.
  • ERR:SYNTAX is thrown when trying to evaluate a command that doesn't return a value.

Related Commands