TI-Basic 89 Programming/Output

From Wikibooks, open books for an open world
< TI-Basic 89 Programming
Jump to: navigation, search

Disp[edit]

Disp, I/O(F3):2, is a command which will display a number, string, equation or other type of variable/literal given as arguments. Disp can accept an unlimited number of arguments seperated by commas (although it recommended to keep the number of arguments under 7 because after seven, for each consecutive argument the screen pushes everything else up passed the top of the screen, even the seventh pushes the first line up a slight amount), and will display each argument following the previous line.

Syntax: Disp[edit]

:Disp [arg][,arg2][,arg3][,arg4][,…argN]
  • Where arg,arg2,arg3,arg4 and all other arguments through argN are optional parameters. The number of arguments is only limited by the calculator memory. The arguments can be either a literal or variable of any type.
  • For each argument, Disp displays the argument on the next line, starting from where the the cursor initially was located. If the display reaches the seventh line, the display will 'scroll' the rest of the screen up so that the argument can be displayed.
  • Disp displays all arguments left-aligned
    • if what is being displayed contains more than 26 characters string will "run off the screen", resulting in a display of only a part of the 27th character and none of the ones beyond that being shown.
  • If no argument is specified, the command does nothing.


Ex: Display Lines[edit]

Assuming you have stored the value 5 into x (via 5→x) and a blank I/O screen and you executed this program,

:Disp "HELLO WORLD",52,x+1

you would have the following on your I/O screen:

HELLO WORLD
52
6

Ex: Empty Lines[edit]

:Disp "","","HELLO WORLD"


HELLO WORLD

Ex: Truncated[edit]

:Disp "This line too long for one line"
This line too long for one

Pause[edit]

Pause, Control(F2):Transfers(8):1, displays an argument, then pauses execution afterwards.

Syntax: Pause[edit]

:Pause [arg]
  • Where arg is either a literal or any variable type which Pause will display then pause execution of the rest of the program until the enter key is pressed
    • Pause will display arg on the next line, starting from where the the cursor initially was located. If the display reaches the seventh line, the display will 'scroll' the rest of the screen up so that the argument can be displayed
    • Pause will always display arg left-aligned
    • If an argument is too long to be displayed, the argument will be truncated and an arrow will be displayed indicating you may scroll left/right to read the entirety of the line.
  • If no argument is specified, the command merely pauses the execution until enter is pressed without displaying anything

Ex: Hello[edit]

:Pause "Hello World!"

*It should be noted that the program execution would pause until enter is pressed.

**You may get the ! symbol by pressing 2nd+Math(5):Probability(7):1, or Diamond+Divide(÷) on the TI-89 or 2nd+W on the TI-92 Plus and Voyage 200.

Ex: Pause[edit]

:Pause

*It should be noted that the program execution would pause until enter is pressed.

Output[edit]

Output, I/O(F3):6, allows the display of an argument in a location other than the next line. The item to be displayed is outputted to the specified coordinates supplied to the function. It is useful for formatted display.

Syntax: Output[edit]

:Output row,col,arg
  • Where row is a number (can be positive or negative) which determines the row location (vertically, in pixels) arg is to be displayed.
  • Where col is a number (can be positive or negative) which determines the column location (horizontally, in pixels) arg is to be displayed
  • Where arg is the argument to be displayed. This can be a number, string or list.
    • arg is displayed from left to right
    • if arg doesn't fit on one line, the parts that don't fit are cut out.
    • Each new Output command used overwrites the previous ones.


Ex: Basic[edit]

:Output 24,0,"HELLO WORLD"


HELLO WORLD

*HELLO WORLD is moved down two rows (24 pixels is the equivalent of two rows).

Ex: Too Long[edit]

:Output 0,100,"This is too long"
                This is to

Return[edit]

Return, Control(F2):Transfers(8):2, displays an argument on the home screen, or just returns to the home screen if no argument is supplied.

Syntax: Return[edit]

:Return [arg]
  • Where arg is any literal or variable.
  • This command will return the argument to the home screen only if used in a Function.
    • You can check to see whether you have a program or a function by the line under the title. If it says Prgm, then it is a program. If it says Func, then it is a function.
  • arg will always be right-aligned
  • When used without arg, whether in a Program or a Function, it will terminate the running of the code.


Ex: Return[edit]

Let's say you stored the value 5 in x (using 5→x) before executing the function. For the sake that this can only be used in a function, the appropriate tags and a name are supplied for this example.

temp()
:Func
:Return 2x+1
:EndFunc
▪temp()                 11


Previous: Basic Variables
Next: Input
Table of Contents: TI-Basic 89 Programming