home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
tipi
/
varsampl.tpi
< prev
Wrap
Text File
|
1993-11-07
|
2KB
|
74 lines
# VARSAMPLE.TPI
# by Kent Peterson
# This program demonstrates the three
# types of variables in TIPI along with
# the table data structure.
defvar price
3 defarray zipcode
defstr Man$
deftable kid$ # This sets the
"Bart" "Lisa" "Maggie" # table kid$ to
endtable # to hold the names
# of three kids.
100 price store # This stores 100 in
# the variable price.
10605 1 zipcode store # This stores
60609 2 zipcode store # different zipcodes
90210 3 zipcode store # in each of the
# three zipcode
# slots.
"Homer" Man$ store # This stores the
# word "Homer" in
# the variable Man$.
# Now let's use these variables
# and the table
"Hi, I'm " print$
Man$ fetch print$ # You have to fetch
# the contents of
# a variable before
# you can print it out.
"." print$ cr
"My kids are named "
print$
1 kid$ print$ # Tables are initialized
# when they are defined
# and they auto-fetch.
# DO NOT USE A FETCH
# with a table.
", " print$
2 kid$ print$
" and " print$
3 kid$ print$
"." print$ cr cr
"My car cost $" print$
price fetch print
"." print$ cr cr
"My zipcode is " print$
1 zipcode fetch print # Array values
# are fetched and
# and stored using
# their names and
# their index values.
" but I wish it was "
print$
3 zipcode fetch print
"." print$ cr
begin key until # This sequence of
# instructions waits
# until you press
# a key.