jmp-l
[Top] [All Lists]

Re: Adding an Item to a list

To: jmp-l@lists.biostat.wustl.edu
Subject: Re: Adding an Item to a list
From: Steve Hodge <steve@nmr.mgh.harvard.edu>
Date: Fri, 16 May 2008 10:49:54 -0400 (EDT)
In-reply-to: <1EB87E4BC4B41244A6B223D1DCAF67CA024CDF63@aazajnb155.anglo.local>
References: <1EB87E4BC4B41244A6B223D1DCAF67CA024CDF63@aazajnb155.anglo.local>
You can also use:

mylist = {a, b, c};
insert into( mylist, {d} );
//mylist is now {a, b, c, d}

... or you can include an optional third argument to insert the item at a particular position, rather than at the end (the default).

insert into( mylist, {e}, 1 ):
//mylist is now {e, a, b, c, d}


Steve


On Fri, 16 May 2008, Nel, Fanie wrote:

Dear List,

How do I append a value to a list variable ?

For example if mylist = List{a,b,c} how do I add another item ,d, to the
list so that mylist = {a,b,c,d} ?

Thank you
Fanie Nel


From: Guillaume BUGNON <guillaume.bugnon@soitec.fr>
----------------------------------------


Hi Fanie,

You can add an item to a list like that :

mylist = List();
mylist = {a,b,c};

mylist = mylist || {d};

Regards,
Guillaume
________________________________



<Prev in Thread] Current Thread [Next in Thread>