-- Seq1.ex ----------------------------------------------------------------------
-- Baby demo of a sequence.
-- --------------------------------------------- ---------------------------------
include misc.e -- this include file contains the function reverse() which is
-- used below.
sequence number_list -- declare a sequence called number_list
-- if we didn't do this next line, the program would fail as soon as it
-- tried to add numbers to number_list, because number list would have had
-- no pre-exixting value.
number_list = {} -- initialize it to be a Null (empty) sequence
? number_list -- print list on the screen
-- now let the program load the list with numbers 10,20, ... 100
for num = 10 to 100 by 10 do
-- the append instruction adds each num to the end of the list
number_list = append(number_list, num)
end for
? number_list -- print list as it is now on the screen
-- this reverses the order of the numbers in number_list
number_list = reverse(number_list)
? number_list -- print once again
puts(1,"\n\n") -- down to lines on screen
system("Pause",2) -- wait so user can see what we've done
-- there's nothing more; the program ends its execution here
-- End of program listing -------------------------------------------------------
Conversion to HTML by PC2HTM.EXE