OCLOperators Sequence
No edit summary
Line 1: Line 1:
Creates a sequence (collection) of your choosing.
This creates a sequence (collection) of your choosing.


===== Integers =====
===== Integers =====
If you need a sequence of numbers for iteration or numbering, use Sequence
If you need a sequence of numbers for iteration or numbering, use Sequence
  Sequence{0..20}
  Sequence{0..20}
Will create an collection of integers.
It will create a collection of integers.


===== Strings =====
===== Strings =====
  Sequence{'String', 'EmailAddress'}
  Sequence{'String', 'EmailAddress'}
It's not really needed to use Sequence for this, [[OCLOperators Set|Set]] or [[OCLOperators Bag|Bag]] works equally well.
It's not necessary 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.)
[[Category:Operators]]
[[Category:Operators]]
[[Category:OCL]]
[[Category:OCL]]

Revision as of 11:21, 28 February 2023

This creates a sequence (collection) of your choosing.

Integers

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

Sequence{0..20}

It will create a collection of integers.

Strings
Sequence{'String', 'EmailAddress'}

It's not necessary 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 92 days ago on 02/10/2024. What links here