SHARE
TWEET

Reason for Python's for/while else-clause

rhettinger Oct 18th, 2011 1,620 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Simulating a while-else contruct with gotos and an if-else */
  2.  
  3. goto looptest;
  4. body: {
  5.     /* code for the loop body goes here
  6.        "continue" translates to "goto looptest;"
  7.        "break" translates to "goto done;"
  8.     */
  9. }
  10. looptest:
  11.     if (condition) {
  12.         goto body;
  13.     } else {
  14.         /* code for the else-clause goes here */
  15.     }
  16. done:
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top