| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== MAXIMUM (return maximum subscript value) ====== | [[match return matching values .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[message return message box response .htm|{{btn_next_n.gif|Next page}}]] | | || **MAXIMUM(**//variable//,//subscript//**)** {{blk2blue.jpg|blk2blue.jpg}} | **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** ** CODE** ** 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** **  END** ** END** **Clarion# Example:** | **array BYTE,DIM(10,12)  !first dimension is 10 elements** | | | | **  CODE** | | **  !the dimension starts at zero** | | **  MAXIMUM(array,0)       ! so this returns 10 (zero is first dimension)** | **See Also:** [[dim set array dimensions .htm|DIM]] [[prototype parameter lists.htm|Prototype Parameter Lists (Passing Arrays)]]