How to get an exit from for loop because my code always gets the latest result from the for loop? What\'s wrong with my for loop condition
for