As the name implies. Basically, I am updating a variable (real) array... let's call it example[5][i]. Is there an elegant solution to compare all of these numbers and return the index of the lowest one?
I know I can probably compare them one by one using a while loop, but I was hoping for an elegant solution.
As far as I'm aware there's nothing included by default to accomplish this. It won't be to hard to just make yourself a function that loops and returns that value when passed an array. (I suggest a function instead of an inline while loop, that way you can build up your own toolset of functions to help any future projects you make run smoother.)
Making some headway in understanding how to call functions. I have another roadblock with the input parameter. I need to use an entire array into the function for it to be any more use than just writing a trigger. However, I can't seem to figure out how to pass the whole (real) array into the function.
Any suggestions?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
As the name implies. Basically, I am updating a variable (real) array... let's call it example[5][i]. Is there an elegant solution to compare all of these numbers and return the index of the lowest one?
I know I can probably compare them one by one using a while loop, but I was hoping for an elegant solution.
@En7ropi: Go
As far as I'm aware there's nothing included by default to accomplish this. It won't be to hard to just make yourself a function that loops and returns that value when passed an array. (I suggest a function instead of an inline while loop, that way you can build up your own toolset of functions to help any future projects you make run smoother.)
@Dustin374: Go OK.
I'll have to look up how to use functions. I'm new to the editor but not programming, so luckily this has been a steady (albeit slow) process.
Making some headway in understanding how to call functions. I have another roadblock with the input parameter. I need to use an entire array into the function for it to be any more use than just writing a trigger. However, I can't seem to figure out how to pass the whole (real) array into the function.
Any suggestions?