Question: Quitting a search with several for

Assume we have a sreach with 10 for, for example

answer=0:

for i[1] from 1 by 1 to 5 do

    for i[2] from 1 by 1 to 5 do 

        ...

        if .... then answer=1: print(i[1],...,i[10]); "quitting the search"

        ...

     end do

end do

If I write break at qutting part, it will only exit from one for, one idea is putting if answer=1 break before end do of the rest for, that is why I used the local extra variable "answer" but is this the best idea? Any better idea which contains checking less if is apprecied.

Please Wait...