Tutorial 2: Displaying Text
Displaying Home Screen Text...
HOME >> Tutorials >> Tutorial 2: Displaying Text

Introduction:
In this tutorial, we will display text by using two different methods: displaying and outputting. On the home screen, the text will look the same, but you use each method in different situations.

New Commands:

: (Colon) Used to combine commands
Disp Displays each value
Output( Displays text or value beginning at a specific row and column

The Codes:
There will be several different codes showing how to use Disp and Output(.

: For AShell, SOS, and TI-Explorer
ClrHome Clears the home screen
Disp 475 Displays the value 475
Disp "HELLO" Displays the text "HELLO"

The next code will still use Disp, but it'll show how you write both display commands on the same line.

: For AShell, SOS, and TI-Explorer
ClrHome Clears the home screen
Disp 475,"HELLO" Displays the value 475 and the text "HELLO"

The next code will also still use Disp, and will show you another way to write both display commands on the same line.

: For AShell, SOS, and TI-Explorer
ClrHome Clears the home screen
Disp 475:Disp "HELLO" Displays the value 475 and the text "HELLO"

These are all 3 different ways of displaying the same thing. The most common way is the second. Having different ways of doing the same thing develops different programming styles. Usually programmers program the same way in every program. This last code shows how to move what is being displayed to lower lines.

: For AShell, SOS, and TI-Explorer
ClrHome Clears the home screen
Disp "","",475,"HELLO" Displays the value 475 and the text "HELLO" on the third and fourth line

Disp "" just makes a blank line. Notice how the text is displayed on the left and the number is displayed on the right. You can move the text over by doing something like this: Disp " HELLO" (five spaces over). However, there is no way that I know of for moving the numbers left. This is one of the reasons for using Output( over Disp. Another reason for using Output( instead of Disp is if you want numbers and text on the same line. In the next section of code, I will show you how to use Output(.

: For AShell, SOS, and TI-Explorer
ClrHome Clears the home screen
Output(4,1,475) Displays the value 475 starting at row 1 and column 7
Output(4,6,"HELLO") Displays the text "HELLO" starting at row 4 and column 4

Further Explanation:
As you can see with Output( you can put both the text and value wherever you like. You can also combine the two Output lines into one using the colon(:) Output(4,1,475):Output(4,6,"HELLO"). I personally would rather separate them into two lines.

Conclusion:
Well now you know how to display text and values in a programming. Another main difference between Disp and Output( is that with Disp, it clears the whole line before displaying the text or value. With Output( it just overwrites the length of the text or value and that's all. If you didn't ClrHome before using Output(, it will just display the text or value in the designated spot only. You could still have other characters on the same line. If you want a really good example of how Output( overwrites, click here. I think I explained everything in this tutorial well enough for you to understand. Next, we will go over storing and deleting variables (user variables, strings, lists, matrices, etc.).

If you do not understand a particular part in this lesson, have suggestions, or find any problems please contact me.

Previous Tutorial Next Tutorial
Tutorial 1 Tutorial 3





Problems with this page?
Contact the Webmaster.