Part of the Samples Website. 8/16/97.

samples.lists.sample1

«This script contains examples used in the Frontier 3.0 main read me
«To see how it works, step thru the script using the debugger
local (myList)
myList = {} «set it to the empty list
dialog.alert (sizeof (myList)) «displays 0
myList = {"red", "green", "blue"} «now it's a 3-element list
dialog.alert (sizeof (myList)) «displays 3
local (element)
for element in myList
dialog.alert (element)
myList = myList + {"orange", "cyan"} «now it's a 5-element list
dialog.alert (sizeof (myList)) «displays 5
myList = myList - "red" «remove an element from the list
dialog.alert (sizeof (myList)) «displays 4
dialog.alert (myList contains "green") «displays true
myList = myList - "magenta" «remove an element that isn't there
dialog.alert (sizeof (myList)) «displays 4
local (list2)
list2 = {"Beethoven", "Mozart"} «list 2 has 2 musicians
myList = myList + list2 «adding 2 lists
dialog.alert (sizeof (myList)) «displays 6
«convert each element of the list to uppercase
local (i)
for i = 1 to sizeOf (myList)
myList [i] = string.upper (myList [i])
dialog.alert (myList)


This page was last built on Sat, Aug 16, 1997 at 6:42:40 PM. You can download the current set of sample scripts from our FTP site. Dave