10-02-2019, 07:32 PM
Is there an elegant way to break from nested loops to 'outer' loop (or even to top-level loop if multiply nested). I know you could use goto statement but I try to avoid as much as possible in my program because it feels messy.
I am okay if there is no better answer
Thanks,
S
Macro Macro132
I am okay if there is no better answer
Thanks,
S
Macro Macro132
ARRAY(str) arr1 = "1[]2[]3[]4[]5[]6"
ARRAY(str) arr2 = "A[]B[]C[]D[]E"
int r
for _i 0 arr1.len
,;out F"{_i}: '{arr1[_i]}'"
,for r 0 arr2.len
,,if arr2[r] = "C"
,,,break;;want to break out of outer loop here as well instead of using goto statement
,,,;goto g1
,,out F"{_i}: '{arr1[_i]}' : {r}: {arr2[r]}"
,out "---------"
;g1