Join us today!

Notifications
Clear all

Find Array Bounds

1 Posts
1 Users
0 Reactions
1,128 Views
twinControls
Posts: 114
Admin
Topic starter
(@twincontrols)
Member
Joined: 2 years ago

Create a generic function to find the bounds of one-dimensional array.  

Inputs:
iArray (Any type of array, integer array, char array, bool array etc..)

Outputs:
isArray(Bool)
nLowerBound(Int)
nUpperBound(Int)
nNumberOfElements(Int)

 

If the input is an array, isArrayshould be True and other outputs should be lower bound, upper bound and the elements count in the array. 
If the input is not an array, nLowerBound and nUpperBound should be -1 and isArray should be False,  nNumberOfElements should be 0.  

Examples: 

findarraybounds

 

findarraybounds2

 

findarraybounds3

 

Happy coding! 💻

Reply
Share: