Advertisement
rhettinger

Reason for Python's for/while else-clause

Oct 18th, 2011
3,645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  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:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement