Exit out of an In or UseCamera statement.
In["./folder/"] ... If[...] Break
The following example loads a folder of images, looks for a cat in each image, and exits the loop if more than three cats were found in an image:
In["./folder/"] Load Detect["cat"] If[Count > 3] Break