bash for loop break on error

C++
break [n] #Exit optional given n number of loops
Source

Also in C++: