Message Boards Message Boards

0
|
176 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

How to break a triple Do loop, once some condition is satisfied?

Posted 24 days ago

Hello, I was wondering if there is a way to break the following triple loop once condition01 is satisfied

Do[Do[Do[
    Which[BLA BLA BLA,  
     list01[[k]] = Append[list01[[k]], list[[i]]]
                             ];   
       If[condition01, Break[]] , {k, 1, 
     SomeNumber}], {j, 1, h}], {i, 1, h}];

This is what I tried, without showing the original program, but I don't know if I have to put the break in another place or maybe add extra breaks. any help would be greatly appreciated

POSTED BY: Issam EL MARIAMI
Posted 24 days ago

Break will only break out of the immediately enclosing loop. You could try Abort or Throw (with Throw you'd also typically wrap the whole thing in Catch).

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract