How do I - Look for in an array

Get help using Construct 2

Post » Tue Jun 03, 2014 6:40 pm

Hi everyone,

I would like to know if there is a way to look for the highest and lowest value inside an array.

Kind regards,
B
6
S
2
Posts: 30
Reputation: 1,127

Post » Tue Jun 03, 2014 9:16 pm

You could use the array "For each element" event. Create a variable to store the value. Then as you loop through the array, compare the current value to the stored value. If it is higher (or lower as the case may be), you would set the variable to the current value.
B
40
S
12
G
11
Posts: 331
Reputation: 7,752

Post » Tue Jun 03, 2014 10:35 pm

Thanks, that seems like an alternative. I was wondering if the Sort function would also help?
B
6
S
2
Posts: 30
Reputation: 1,127


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 18 guests