Number (FloatNamedArraylist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
Line 42: Line 42:
The request prints:
The request prints:
<p class="output">
<p class="output">
110 one-hundred-ten
 
38 thirty-eight
1 7 seven
7 seven
2 38 thirty-eight
&#45;----
3 110 one-hundred-ten
7 seven
38 thirty-eight
110 one-hundred-ten
</p>
</p>



Revision as of 15:17, 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 Number loop over a FloatNamedArraylist :

b %y is collection floatNamedArraylist of string len 32 %i is float %y = new %y(7) = 'seven' %y(38) = 'thirty-eight' %y(110) = 'one-hundred-ten' for %i from 1 to %y:count print %y:number(%y:nameByNumber(%i)) and %y:nameByNumber(%i) and %y:itemByNumber(%i) end for end

The request prints:

1 7 seven 2 38 thirty-eight 3 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.