Hi All
I’m trying to figure out how to structure an if statement to deal with an array of an indeterminate length.
Say I have an array that holds a number of Toggles. This array doesn’t have a set size - it is case specific so could be anything (although it will likely have a length of between 1 and 10).
I would like to have a If statement that says ‘if ALL Toggles in the array are TRUE, do this’, and ‘if ALL toggles in the array are FALSE, do this’.
There’s no situation where I will need to do something based on some being on and some being off - only two statements; one with all on, and one with all off.
Can anyone help with this? I’m not too sure how to tackle it. I could hard code the array items [0, 1, 2] etc up to a safe number but I would like to keep it generic - something that could work with even a thousand Toggles if necessary.
Thanks