CountOf
Function - Returns the number of items in an array.
Inputs
Input |
Data type |
Description |
ARR |
ANY |
Declared array. |
Outputs
Output |
Data type |
Description |
Q |
DINT |
Total number of items in the array. |
Remarks
The input must be an array and can have any data type. This function is particularly useful to avoid writing directly the actual size of an array in a program, and thus keep the program independent from the declaration.
|
FOR i := 1 TO CountOf (MyArray) DO |
In LD language, the operation is executed only if the input rung (EN) is TRUE. The output rung (ENO) keeps the same value as the input rung.
|
|
|
|
||
Array |
Return |
|
Arr1 [ 0..9 ] |
10 |
|
Arr2 [ 0..4 , 0..9 ] |
50 |
|
ST Language
Q := CountOf (ARR);
FBD Language
LD Language
The function is executed only if EN is TRUE.
ENO keeps the same value as EN.
CountOf |
IEC 61131-3 Automation platform > Programming - Reference guide > Basic Operations > CountOf |
Created with the Personal Edition of HelpNDoc: Maximize Your Productivity with HelpNDoc's Efficient User Interface