2

I have a "general-purpose" line-follower encapsulated in a MyBlock that runs an infinite loop.

Now, in a client program, I would like to interrupt that MyBlock if some condition is met; what the condition is should be determined by the client, so I don't want to put that logic into the MyBlock.

I also don't want to terminate the program altogether, and I want to keep the loop in the MyBlock.

Is there a way to break out of the MyBlock?

3

You can use the Loop Interrupt block. Just make sure the name used in the Loop Interrupt block matches the name of the loop inside of the My Block.

Loop Interrupt block

  • Make sure to make explicit calls to turn off the motors – banno Aug 16 '17 at 16:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.