OCLOperators Set
(Created page with "You can use Set with { } to create a set that you may use to loop over, like this: Set{1,2,3,4,5,6,7,8,9,10,11,12}->collect(i| DoSomthingWithAnInt(i))")
 
(Automatically adding template at the end of the page.)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
You can use Set with { } to create a set that you may use to loop over, like this: Set{1,2,3,4,5,6,7,8,9,10,11,12}->collect(i| DoSomthingWithAnInt(i))
You can use Set with { } to create a set 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 [[OCLOperators Sequence]].
 
Other names for set: collection of strings, array of numbers, static array, initialize array, list of numbers.
 
See also: [[OCLOperators Bag]]
[[Category:OCLOperators]]
{{Edited|July|12|2024}}

Latest revision as of 15:40, 10 February 2024

You can use Set with { } to create a set 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 OCLOperators Sequence.

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

See also: OCLOperators Bag

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