Or if you want to create an array with elements already in it (this works
both for array and collections) you can also do

~~~~~~~~~~
{ anElement } "dynamic array syntax, Pharo-only"
~~~~~~~~~~
or
~~~~~~~~
#('element') "static array, works only for scalars"
~~~~~~~~
or
~~~~~~~~~~~~~~~~
Array with: anElement "constructor method, works also with more elements...
Array class>>with:with:with:..."
~~~~~~~~~~~~~~~~
or
~~~~~~~~~~~~~~~~~~~~~~~~~
OrderedCollection with: anElement "as above, but creates a collection
instead"
~~~~~~~~~~~~~~~~~~~~~~~~~

Peter

On Mon, Jun 29, 2015 at 2:23 PM, Henrik Johansen <
henrik.s.johan...@veloxit.no> wrote:

>
> On 29 Jun 2015, at 2:18 , abdelghani ALIDRA <alidran...@yahoo.fr> wrote:
>
> Hi guys,
>
> Is there any way to add an element to an empty array (must not use new:
> anElement)?
>
> Cheers
>
>
> It sounds like you want to use an OrderedCollection, not an Array.
> Those will grow and shrink as needed when you use add:/remove: calls.
>
> Cheers,
> Henry
>

Reply via email to