Created
July 28, 2020 03:17
-
-
Save ejs94/74d95c54334683f7ed8c07685ca99c07 to your computer and use it in GitHub Desktop.
Returns the number of elements in an array in structured text (iec 61131-3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Structured Text (IEC 61131-3) *) | |
SIZEOF(Array); // Return size of entire Array in bytes | |
SIZEOF(Array[0]); // Return size of one element | |
SIZEOF(Array)/SIZEOF(Array[0]); // Return number of elements | |
// Example use | |
for( i = 0 ; i < SIZEOF(Array)/SIZEOF(Array[0]) ; i++){ | |
// loop | |
} | |
(* | |
Source: https://www.youtube.com/watch?v=fakMnyWtFSw | |
Coding Best Practices - This is Automation | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment