title: Is there an inverse behavior to the "else" in a for-else loop?
body: <p>I have a <code>for</code> loop which tests for a condition. I would like to execute some code if the condition was never met. The following code does the opposite:</p>
  
  <pre><code>a = [1, 2, 3]
  for k in a:
      if k == 2:
          break
  else:
      print("no match")
  </code></pre>
  
  <p>"no match" is printed if the <code>break</code> is not reached (for a condition like <code>k == 10</code> for instance). Is there a construction which would do the opposite, i.e. run some code if the <code>break</code> is reached?</p>
  
  <p>I know I can do something like</p>
  
  <pre><code>a = [1, 2, 3]
  match = False
  for k in a:
      if k == 2:
          match = True
  if match:
      print("match")
  </code></pre>
  
  <p>but was looking for a more compact solution, without the flag variable..</p>
  
  <p><strong>Note</strong>: I now realize from the answers that I did not make it clear that I would like to move the "matched" code outside of the for loop. It will be rather large and I would like to avoid hiding it in the for loop (thus the idea of the flag variable)</p>