Short syntax for collection data-type?...
Posted
#1
(In Topic #1396)
Regular

Just a quick question re. populating a collection array…
Is there a shortcut collection syntax that can reduce these lines of code to just two, which would each add a collection (processX) to my collection array (processes[])
Code (gambas)
- processX.add(fileTypes, "%ClearEntries")
- processX.Clear()
- processX.add(fileTypes, "%AddEntries")
i was half hoping that I could use:-
Code (gambas)
Is my first example the shortest way to do this, or is there another 'collection' syntax?
Thanks in advance,
C.
Posted
Guru

Code (gambas)
- cCol = ["Keyname1": variant1, "keyname2": variant2]
That is the one line syntax for creating a collection.
Not sure about further additions though.
Posted
Regular

That is a lot tidier and easy to follow
Code (gambas)
- processes.add( ["%ClearEntries": fileTypes] )
- processes.Add( ["%AddEntries" : fileTypes] )
- processes.add( ["nextEntry" : value] )
- processes.add( ["nextEntry2" : value] )
C.
Posted
Guru

Code (gambas)
- processes = [["%ClearEntries": fileTypes],
- ["%AddEntries": fileTypes],
- ["nextEntry": value],
- ["nextEntry2": value]]
1 guest and 0 members have just viewed this.


