Number (FloatNamedArraylist function): Difference between revisions
mNo edit summary |
No edit summary |
||
Line 19: | Line 19: | ||
<li>If <var>Number</var> is called and there is no item on the <var>FloatNamedArraylist</var> that has the indicated <var class="term">subscript</var>, a <code>0</code> is returned, regardless of the setting of <var>[[UseDefault (FloatNamedArraylist property)|UseDefault]]</var>. | <li>If <var>Number</var> is called and there is no item on the <var>FloatNamedArraylist</var> that has the indicated <var class="term">subscript</var>, a <code>0</code> is returned, regardless of the setting of <var>[[UseDefault (FloatNamedArraylist property)|UseDefault]]</var>. | ||
</ul> | </ul> | ||
==Examples== | |||
The following request demonstrates the numerically ordered | |||
result produced by a <var>[[NameByNumber (FloatNamedArraylist function)|NameByNumber]]</var> loop over a <var>FloatNamedArraylist</var> versus the alphabetically ordered result using a <var>NamedArraylist</var>: | |||
<p class="code">b | |||
%x is collection namedArraylist of string len 32 | |||
%y is collection floatNamedArraylist of string len 32 | |||
%i is float | |||
%x = new | |||
%x(7) = 'seven' | |||
%x(38) = 'thirty-eight' | |||
%x(110) = 'one-hundred-ten' | |||
%y = new | |||
%y(7) = 'seven' | |||
%y(38) = 'thirty-eight' | |||
%y(110) = 'one-hundred-ten' | |||
for %i from 1 to %x:count | |||
print %x:nameByNumber(%i) and %x:itemByNumber(%i) | |||
end for | |||
for %i from 1 to %y:count | |||
print %y:nameByNumber(%i) and %y:itemByNumber(%i) | |||
end for | |||
end | |||
</p> | |||
The request prints: | |||
<p class="output"> | |||
110 one-hundred-ten | |||
38 thirty-eight | |||
7 seven | |||
----- | |||
7 seven | |||
38 thirty-eight | |||
110 one-hundred-ten | |||
</p> | |||
==See also== | ==See also== |
Revision as of 15:14, 23 September 2020
Item number of specified name (FloatNamedArraylist class)
Number returns the item number (ordinal) of the item that has the specified subscript in the FloatNamedArraylist.
Syntax
%number = fltNal:Number( subscript)
Syntax terms
%number | A numeric variable to contain the item number of the fltNal item selected by subscript. |
---|---|
fltNal | A FloatNamedArraylist object. |
subscript | A numeric value that serves as a subscript to identify a fltNal item. |
Usage notes
- If Number is called and there is no item on the FloatNamedArraylist that has the indicated subscript, a
0
is returned, regardless of the setting of UseDefault.
Examples
The following request demonstrates the numerically ordered result produced by a NameByNumber loop over a FloatNamedArraylist versus the alphabetically ordered result using a NamedArraylist:
b %x is collection namedArraylist of string len 32 %y is collection floatNamedArraylist of string len 32 %i is float %x = new %x(7) = 'seven' %x(38) = 'thirty-eight' %x(110) = 'one-hundred-ten' %y = new %y(7) = 'seven' %y(38) = 'thirty-eight' %y(110) = 'one-hundred-ten' for %i from 1 to %x:count print %x:nameByNumber(%i) and %x:itemByNumber(%i) end for for %i from 1 to %y:count print %y:nameByNumber(%i) and %y:itemByNumber(%i) end for end
The request prints:
110 one-hundred-ten 38 thirty-eight 7 seven ----- 7 seven 38 thirty-eight 110 one-hundred-ten
See also
- The ItemByNumber property lets you retrieve or set an item using the item's ordinal number.
- The NameByNumber function lets you retrieve an item's name using the item's ordinal number.