List
A List is an ordered collection of dynamic size. Like all other collections, they are passed by reference. You create a table by declaring a collection within square brackets. The following declares an empty List:
Dim myList = []
Construction of a Table is similar to that of a list, except that the keys are implicit, based on order:
Dim myCats = [ "Chester", "Charlotte", "Chloe", "Julius" ]
You can add items to the list with Append, which adds the elements to the end of the list:
Dim myCats = []
myCats.Append( "Chester" )
myCats.Append( "Charlotte" )
myCats.Append( "Chloe" )
myCats.Append( "Julius" )
Or with Prepend, which adds elements to the beginning:
Dim myCats = []
myCats.Prepend( "Julius" )
myCats.Prepend( "Chloe" )
myCats.Prepend( "Charlotte" )
myCats.Prepend( "Chester" )
Or Insert, which specifies a position to insert at:
Dim myCats = []
myCats.Insert( 1, "Julius" )
myCats.Insert( 2, "Chloe" )
myCats.Insert( 3, "Charlotte" )
myCats.Insert( 4, "Chester" )
Elements can be accessed by index, starting at 1. Attempting to access a non-existant element will result in wxb throwing an error.
Print myCats[3]
You can also access a slice of elements:
Print myCats[2:3]