What would be the equivalent of while in python?

Asked

Viewed 580 times

-1

What would be python’s "do while"?

Grateful!

1 answer

1

There is no "do while" in Python, there are ways to do something very similar, using the options already existing in the language.

Example:

condition = True
while condition:
    # Corpo do laço
    condition = teste_laco_condicao()

This example was based on the powderflask response

There are other ways to do, in the link below there are a few more examples, this question was asked in English: https://stackoverflow.com/questions/743164/emulate-a-do-while-loop-in-python

Browser other questions tagged

You are not signed in. Login or sign up in order to post.