Item (FloatNamedArraylist property): Difference between revisions
Jump to navigation
Jump to search
m (→Usage notes) |
m (→Usage notes) |
||
Line 24: | Line 24: | ||
<li>If the <var>Item</var> property is being set and there is already an item on the <var>FloatNamedArraylist</var> that has the specified subscript, that item is replaced. If the <var>Item</var> property is being set and there is no item on the <var>FloatNamedArraylist</var> that has the indicated subscript, the item is added. If the <var>Item</var> property is being retrieved and there is no item on the <var>FloatNamedArraylist</var> that has the indicated subscript, the result is one of the following actions: | <li>If the <var>Item</var> property is being set and there is already an item on the <var>FloatNamedArraylist</var> that has the specified subscript, that item is replaced. If the <var>Item</var> property is being set and there is no item on the <var>FloatNamedArraylist</var> that has the indicated subscript, the item is added. If the <var>Item</var> property is being retrieved and there is no item on the <var>FloatNamedArraylist</var> that has the indicated subscript, the result is one of the following actions: | ||
<ul> | <ul> | ||
<li> | <li>If the <var>[[UseDefault (FloatNamedArraylist property)|UseDefault]]</var> property value is <code>False</code>: | ||
<ul> | |||
<li>Under <var>Sirius Mods</var> version 8.0 and later an [[ItemNotPresent class|ItemNotPresent exception]] is thrown. | |||
<li>Under <var>Sirius Mods</var> version 7.9 and earlier the request is cancelled. | |||
</ul> | |||
<li>The <var>[[Default (FloatNamedArraylist property)|Default]]</var> value is returned if the <var>UseDefault</var> property is <code>True</code>. | <li>The <var>[[Default (FloatNamedArraylist property)|Default]]</var> value is returned if the <var>UseDefault</var> property is <code>True</code>. | ||
</ul> | </ul> |
Revision as of 00:55, 20 October 2011
Value of named item (FloatNamedArraylist class)
Item is a ReadWrite property returns or sets the value of the item that has the specified subscript number in the FloatNamedArraylist.
For additional comments about the Item method in collections, see "Coding considerations for collections".
Syntax
%currentItem = fltNal:Item( number) fltNal:Item( number) = newItem Throws ItemNotPresent
Syntax terms
%currentItem | A variable of the same type as specified on the fltNal declaration to contain the value of the specified fltNal item. Or a variable or value of the same type as specified on the fltNal declaration to be assigned to the specified fltNal item. |
---|---|
fltNal | A FloatNamedArraylist object. |
number | A number that serves as a subscript to identify a fltNal item. |
Usage notes
- The Item keyword is not required. For example, in the request in the FloatNamedArraylist class example,
%y(7) = 'seven'
, for instance, is equivalent to:%y:item(7) = 'seven'
- If the Item property is being set and there is already an item on the FloatNamedArraylist that has the specified subscript, that item is replaced. If the Item property is being set and there is no item on the FloatNamedArraylist that has the indicated subscript, the item is added. If the Item property is being retrieved and there is no item on the FloatNamedArraylist that has the indicated subscript, the result is one of the following actions:
- If the UseDefault property value is
False
:- Under Sirius Mods version 8.0 and later an ItemNotPresent exception is thrown.
- Under Sirius Mods version 7.9 and earlier the request is cancelled.
- The Default value is returned if the UseDefault property is
True
.
Regardless of the value of UseDefault, the presence of the item with the indicated name can be checked using the Number function, for example:
%num = %myLis:number(%key) if %num then %name = %myLis:itemByNumber(%num) ...
- If the UseDefault property value is
- As shown in the example in the FloatNamedArraylist class article, FloatNamedArraylist items are ordered numerically by their subscript numbers. Accordingly, the Item method takes a numerical subscript argument.
See also
- The ItemByNumber property lets you retrieve or set an item using the item's ordinal number.
- The NameByNumber function lets you retrieve the "name" (numerical subscript) of the item that has the specified item number (position) .