I know you can make lists like this:
aVariable := #(list items here)
But how do I remove certain ones, like
remove item 2 of list
Offline
and how to add to the lists and call values?
Offline
nXIII wrote:
Look, just open a browser and go to "Collections-Sequencable" -> "OrderedCollection" and look for yourself.
I have absolutely no clue what you mean by "call values"
i think jd1 means like
list at: 1
or
list first
Offline
So im clear:
A ordered collection (list)
|oc|
oc := {'array'.'array'.'array'} as: OrderedCollection. "A OC"
oc removeAt: 2. "remove thing 2"
oc := #(symbol 'string' (array)) as: OrderedCollection. "What does this do?"
oc removeLast; removeFirst; removeAll. "removing things"
oc at: 1. "Item 1 of oc"
oc first. "The first record in oc"
How do I add a new entry?
oc add: 'string' "Is this how?"
oc add: 'string' after: 'string to find' "Is this how I add something after something else"
Am I correct?
Offline
johnnydean1 wrote:
So im clear:
A ordered collection (list)
|oc|
oc := {'array'.'array'.'array'} as: OrderedCollection. "A OC"
oc removeAt: 2. "remove thing 2"
oc := #(symbol 'string' (array)) as: OrderedCollection. "What does this do?"
oc removeLast; removeFirst; removeAll. "removing things"
oc at: 1. "Item 1 of oc"
oc first. "The first record in oc"How do I add a new entry?
oc add: 'string' "Is this how?"
oc add: 'string' after: 'string to find' "Is this how I add something after something else"
Am I correct?
Yes. add: is equivalent to addLast: (add after the last index). There's also addFirst and add: afterIndex:
Offline