Item (Arraylist property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (what's in a name)
m (cross refernece better)
Line 1: Line 1:
{{Template:Arraylist:Item subtitle}}
{{Template:Arraylist:Item subtitle}}
<var>Item</var> is a ReadWrite property returns or sets the indicated item in the <var>Arraylist</var>.  For additional description of this method, see [[Collections#Coding considerations for collections|"Coding considerations for collections"]].
<var>Item</var> is a ReadWrite property returns or sets the indicated item in the <var>Arraylist</var>.  For additional description of this method, see [[Collections#Coding considerations for collections|"Coding considerations for collections"]].


Line 24: Line 23:


==See also==
==See also==
<ul><li>Methods are available to retrieve or set just the first or last item in an <var>Arraylist</var>; see [[FirstItem (Arraylist property)|FirstItem]] and [[LastItem (Arraylist property)|LastItem]] respectivly.</ul>
<ul><li>Explicitly references to retrieve or set just the first or last item in an <var>Arraylist</var> can be done via <var>[[FirstItem (Arraylist property)|FirstItem]]</var> or <var>[[LastItem (Arraylist property)|LastItem]]</var> respectivly.</ul>
{{Template:Arraylist:Item footer}}
{{Template:Arraylist:Item footer}}

Revision as of 06:58, 11 March 2011

Return or set Arraylist item value (Arraylist class)

Item is a ReadWrite property returns or sets the indicated item in the Arraylist. For additional description of this method, see "Coding considerations for collections".

Syntax

%currentItem = al:Item( number) al:Item( number) = newItem

Syntax terms

%currentItem A variable of the same type as specified on the al declaration to contain the value of the specified al item.
al An Arraylist object.
number A whole number greater than 0 to identify an al item by its position within the arraylist. If number is greater than the number of items in the al, or if it is less than or equal to zero, the request is cancelled.
newItem A value of the same type as specified on the al declaration to be assigned to the specified al item.

Usage notes

  • The Item keyword is not required. For instance, in the For loop in the Arraylist class example, print %alist(%i) is equivalent to:

    print %alist:Item(%i)

See also

  • Explicitly references to retrieve or set just the first or last item in an Arraylist can be done via FirstItem or LastItem respectivly.