User Tools

Site Tools

Navigation:  Language Reference > 13 - Built-in Functions >====== MAXIMUM (return maximum subscript value) ====== Previous pageReturn to chapter overviewNext page



MAXIMUM Returns maximum subscript value.
variable The label of a variable declared with a DIM attribute.
subscript A numeric constant for the subscript number. The subscript identifies which array dimension is passed to the procedure. In Clarion Win32, subscript is 1-based. In Clarion# for .NET applications, subscript is zero (0) based.

The MAXIMUM procedure returns the maximum subscript value for an explicitly dimensioned variable. MAXIMUM does not operate on the implicit array dimension of STRING, CSTRING, or PSTRING variables. This is usually used to determine the size of an array passed as a parameter to a procedure or procedure.

Return Data Type: LONG

Clarion Win32 Example:

Array BYTE,DIM(10,12)      !Define a two-dimensional array

 !For the above Array:   MAXIMUM(Array,1) returns 10

 !                       MAXIMUM(Array,2) returns 12


LOOP X# = 1 TO MAXIMUM(Array,1)    !Loop until end of 1st dimension

 LOOP Y# = 1 TO MAXIMUM(Array,2)   !Loop until end of 2nd dimension

  Array[X#,Y#] = 27                !Initialize each element to default



Clarion# Example:

array BYTE,DIM(10,12)  !first dimension is 10 elements
 !the dimension starts at zero
 MAXIMUM(array,0)       ! so this returns 10 (zero is first dimension)

See Also:


Prototype Parameter Lists (Passing Arrays)

maximum_return_maximum_subscript_value_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)