conIns Function

Inserts one or more elements into a container.


container conIns (
        container container, 
    int start, 
    anytype element,
        ... )

Parameter

Description

container

The container to insert elements into.

start

The position at which to start inserting elements.

The first element is specified by the number 1.

To insert after the n element specify start as n+1.

element

One or more elements to insert. Separate each element by using a comma.

The new container.

You can also use the += operator to add values of any type into a container. For example, to create a container that contains the first ten square numbers.

int i;
container c;
;
 
for (i = 1; i < = 10; i++)
{
    c += i+i;
} 

static void conInsExample(Args _arg)
{
    container c;
    int i;
    ;
 
    c = conIns(["item1", "item2"], 1);  
    for (i = 1 ; i <= conLen(c) ; i++)  
    {
    // Prints the content of a container.
        print conPeek(c, i);
    }
    pause;
}

Community Additions

ADD
Show: