From what I understand in your question, it depends on what you need. For loops just keep repeating whatever is within it until a condition is met.
I pretty sure for your scenario you would need 2 for loops, because you would need to sort an whole array before checking it.
However you should be careful when using max_y in your second for loop because it is declared in the first one making it inaccessible in the second one. (Unless you have it declared as a global variable elsewhere)
Yeah that’s my problem…I want to use the variable max_y in the second loop to check the other values but i don’t know how to do it…
My problem is very simple: one for loop finds a max value for a table that i load and divide it by 2 and the other same for loop check if there are values above max_y/2.