How to break several nested 'for' loop in one 'if'

A reply along the same line was recently given here.