OCLOperators Set
No edit summary
No edit summary
Line 1: Line 1:
You can use Set with { } to create a set that you may use to loop over, like this:
You can use Set with { } to create a set that you may use to loop over.
 
A Set contains '''no duplicates''', otherwise it's just a collection of something.
 
With Integers
  Set{14,22,12,53,2,11,66}->collect(i| DoSomthingWithAnInt(i))
  Set{14,22,12,53,2,11,66}->collect(i| DoSomthingWithAnInt(i))
 
With Strings
Set{'String', 'EmailAddress'}->collect(s| DoSomthingWithAString(s))
If you want to create a sequence of numbers (in order) you can use the [[Sequence operator]].
If you want to create a sequence of numbers (in order) you can use the [[Sequence operator]].


Other names for set: array of numbers, static array, initialize array, list of numbers
Other names for set: collection of strings, array of numbers, static array, initialize array, list of numbers
[[Category:OCLOperators]]
[[Category:OCLOperators]]

Revision as of 10:10, 11 February 2021

You can use Set with { } to create a set that you may use to loop over.

A Set contains no duplicates, otherwise it's just a collection of something.

With Integers

Set{14,22,12,53,2,11,66}->collect(i| DoSomthingWithAnInt(i))

With Strings

Set{'String', 'EmailAddress'}->collect(s| DoSomthingWithAString(s))

If you want to create a sequence of numbers (in order) you can use the Sequence operator.

Other names for set: collection of strings, array of numbers, static array, initialize array, list of numbers

This page was edited 84 days ago on 02/10/2024. What links here