title: Python break from if statement to else
body: <p>(I'm a Python newbie, so apologies for this basic question, I for some reason couldn't find an answer to.)</p>
  
  <p>I have a nested <code>if</code> statement with the <code>if</code> statement of an <code>if</code>/<code>else</code> block. In the <em>nested</em> <code>if</code> statement, if it it meets the criteria, I'd like the code to break to the <code>else</code> statement. When I put a <code>break</code> in the nested <code>if</code>, though, I'm not sure if it's breaking to the <code>else</code> statement.</p>
  
  <p>I'd like to find the longest substring in alphabetical order of a given string, <code>s</code>. Here's my code:</p>
  
  <pre><code>s = 'lugabcdeczsswabcdefghij'
  longest = 1
  alpha_count = 1
  longest_temp = 1
  longest_end = 1
  for i in range(len(s)-1):
      if (s[i] &lt;= s[i+1]):
          alpha_count += 1
          if (i+1 == (len(s)-1)):
              break
      else:
          longest_check = alpha_count
          if longest_check &gt; longest:
              longest = longest_check
              longest_end = i+1
          alpha_count = 1
  print(longest)
  print('Longest substring in alphabetical order is: ' + 
      s[(longest_end-longest):longest_end])
  </code></pre>
  
  <p>(Yes, I realize there's surely lots of unnecessary code here. Still learning!)</p>
  
  <p>At this nested <code>if</code>:</p>
  
  <pre><code>if (i+1 == (len(s)-1)):
              break
  </code></pre>
  
  <p>...if <code>True</code>, I'd like the code to break to the <code>else</code> statement. It doesn't seem to break to that section, though. Any help?</p>