OCLOperators Sequence
No edit summary
No edit summary
Line 5: Line 5:
  Sequence{0..20}
  Sequence{0..20}
Will create an collection of integers.
Will create an collection of integers.
===== Strings =====
Sequence{'String', 'EmailAddress'}
It's not really needed to use Sequence for this, [[OCLOperators Set|Set]] or [[OCLOperators Bag|Bag]] works equally well.


If you want to create a list of arbitrary numbers you can use the [[OCLOperators Set|Set operator]]
If you want to create a list of arbitrary numbers you can use the [[OCLOperators Set|Set operator]]


(might also be called an array or list)
(might also be called an array or list)
===== Strings =====
Sequence{'String', 'EmailAddress'}
It's not really needed to use Sequence for this, [[OCLOperators Set|Set]] or [[OCLOperators Bag|Bag]] works equally well.
[[Category:Operators]]
[[Category:Operators]]
[[Category:OCL]]
[[Category:OCL]]

Revision as of 10:13, 11 February 2021

Creates a sequence (collection) of your choosing.

Integers

If you need a sequence of numbers for iteration or numbering, use Sequence

Sequence{0..20}

Will create an collection of integers.

Strings
Sequence{'String', 'EmailAddress'}

It's not really needed to use Sequence for this, Set or Bag works equally well.

If you want to create a list of arbitrary numbers you can use the Set operator

(might also be called an array or list)

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