Skip to content

Modern Math Count

Paul Squires edited this page Oct 14, 2026 · 5 revisions

Home › Math Library › Math Library › Count

Count

How many elements the array holds.

Syntax

Count( a( ) as T ) as uint64

Notes

  • Present so that a statistic and its sample size come from the same place -- ubound( a ) - lbound( a ) + 1 is the same number written three ways to get wrong.
  • It is also a RunningStats member, where it counts what has been added so far.

Examples

#import "std/numeric"
using numeric

dim as float64 a( 0 to 4 ) = { 2.0, 4.0, 4.0, 4.0, 6.0 }

print Count( a( ) )          '' 5

'' The same number, without the off-by-one arithmetic
print ubound( a ) - lbound( a ) + 1           '' 5

Library: Math Library
Category: Math Library
Documented under: Members

Clone this wiki locally