Hacker Newsnew | comments | show | ask | jobs | submit login

So technically not "do/while", but:

  while(some_condition):
    do_stuff



No, it's actually this:

  do_stuff
  while(some_condition):
    do_stuff
The advantage of do/while in this situation is avoiding the duplicate code.

-----


I prefer:

    while True:
        codeHere()
        if shouldStop():
            break

-----


More like:

  do_stuff
  while(some_condition):
    do_stuff

-----


Ahh yes - point taken.

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: