Core Function UBound
From Sputnik Wiki
(Difference between revisions)
(→flag) |
m (1 revision) |
||
(5 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
<pre> | <pre> | ||
− | UBound( <array/binary-array | + | UBound( <array/binary-array> ) |
</pre> | </pre> | ||
=== Description === | === Description === | ||
− | Returns the | + | Returns the index of the highest element in an array . |
=== Parameters === | === Parameters === | ||
Line 16: | Line 16: | ||
The binary variable to use. | The binary variable to use. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Return Value === | === Return Value === | ||
− | Success - Returns the | + | Success - Returns the highest index in the array/binary-array. |
− | Failure - Returns | + | Failure - Returns -1. |
=== Remarks === | === Remarks === | ||
− | + | Although this gets the highest index it may not get how many items there are in the array use [[Core Function Count|Count( <array/binary-array> )]] for that. | |
− | + | If you want the lowest index instead of the highest use [[Core Function LBound|LBound( <array/binary-array> )]] for that. | |
− | + | ||
− | + | ||
=== Example === | === Example === | ||
<syntaxhighlight lang="sputnik"> | <syntaxhighlight lang="sputnik"> | ||
− | $ | + | $array = array ("One", "Two", "Three"); |
− | + | println("Highest index is: " . UBound($array) ); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | println(" | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Core Function]] | [[Category:Core Function]] |
Latest revision as of 12:38, 14 June 2015
UBound( <array/binary-array> )
Contents |
Description
Returns the index of the highest element in an array .
Parameters
array/binary-array
The array to use.
OR
The binary variable to use.
Return Value
Success - Returns the highest index in the array/binary-array.
Failure - Returns -1.
Remarks
Although this gets the highest index it may not get how many items there are in the array use Count( <array/binary-array> ) for that.
If you want the lowest index instead of the highest use LBound( <array/binary-array> ) for that.
Example
$array = array ("One", "Two", "Three"); println("Highest index is: " . UBound($array) );