| Type | Function | 
| Description | Returns the upper boundary of a user-defined array as defined in the data types worksheet. If an error occurs, a corresponding runtime error is output in the MESSAGES  window. | 
| Parameters | Inputs  ARR 
 
| Data type: | User-defined ARRAY |  
| Description: | Array whose upper boundary value is to be returned. |   DIM 
Output
 
| Data type: | ANY_INT |  
| Description: | Dimension of the user-defined array. If the value exceeds the possible number of dimensions for arrays, the function outputs a runtime error. Note that currently only input value 1 is supported for this parameter.
 |   OUT 
 
| Data type: | DINT |  
| Description: | Upper boundary value. |  | 
| Example | Boundary detection  using UPPER_BOUND together with LOWER_BOUND: 
Definition of the user-defined array ('MyArray') in the data types worksheetTYPE   MyArray : ARRAY [2..10000] OF INT;
 END_TYPE
LD code
  The variable 'MyArrayVar' is of the data type 'MyArray'.
 | 
| Error behavior |  Error behavior 
The following table shows the errors which may occur while executing the function and the value returned by the function in the corresponding error case. 
 
| Error case | Output value |  
| No array connected to ARR | 0 |  
| Dimension DIM < 1 or DIM > 1 | 0 |  If any of the listed errors occurs, an 'Argument out of range' error is written to the Online log in the MESSAGES window. | 
| Additional information |  EN/ENO behavior 
The POU is only executed if TRUE  is applied to the EN input. If EN = FALSE, the POU is not executed and ENO = FALSE indicates the inactivity. If any of the errors listed under "Error behavior" occurs while executing the function, ENO is set to FALSE. 
 |