Item (Arraylist property): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (1 revision) |
||
Line 13: | Line 13: | ||
{{Template:Arraylist:Item syntax}} | {{Template:Arraylist:Item syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
< | <table class="syntaxTable"> | ||
< | <tr><th><i>%item</i></th> | ||
< | <td>A variable of the same type as specified on the ''%arrayl'' declaration to contain the value of the specified ''%arrayl'' item. Or a variable or value of the same type as specified on the ''%arrayl'' declaration to be assigned to the specified ''%arrayl'' item. </td></tr> | ||
type as specified on the ''%arrayl'' declaration | <tr><th><i>%arrayl</i></th> | ||
to contain the value of the specified ''%arrayl'' item. | <td>An Arraylist object. </td></tr> | ||
Or a variable or value of the same | <tr><th><i>number</i></th> | ||
type as specified on the ''%arrayl'' declaration | <td>A whole number greater than 0 to identify an ''%arrayl'' item by its position in the arraylist. If ''number'' is greater than the number of items in the ''%arrayl'', or if it is less than or equal to zero, the request is cancelled.</td></tr> | ||
to be assigned to the specified ''%arrayl'' item. | </table> | ||
< | |||
< | |||
< | |||
< | |||
by its position in the arraylist. | |||
If ''number'' is greater than the number of items | |||
in the ''%arrayl'', or if it is less than or equal to zero, | |||
the request is cancelled. | |||
</ | |||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> |
Revision as of 23:28, 19 January 2011
Return or set Arraylist item value (Arraylist class)
Item is a member of the Arraylist class.
This 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
%item | A variable of the same type as specified on the %arrayl declaration to contain the value of the specified %arrayl item. Or a variable or value of the same type as specified on the %arrayl declaration to be assigned to the specified %arrayl item. |
---|---|
%arrayl | An Arraylist object. |
number | A whole number greater than 0 to identify an %arrayl item by its position in the arraylist. If number is greater than the number of items in the %arrayl, or if it is less than or equal to zero, the request is cancelled. |
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)
- Methods are available to retrieve or seet the first or just the last item in an Arraylist. See FirstItem and LastItem.