Add do-while loops
Possible syntaxes:
do:
...
while cond
do while cond:
...
do:
...
while: cond
Regardless, they should be compiled to:
while True:
...
if not (cond):
break
FWIW, the third syntax does not seem "Pythonic" to me. In existing control statements the condition goes before the colon, and the colon signals the start of a block. I think the first syntax seems the most intuitive, with the second syntax it might not be obvious how it's different from a normal "while" loop.
Is it possible to consider a different keyword, such as do/until or repeat/until instead of do/while to further distinguish it? (In the case of repeat/until, a 'repeat' without an 'until' could be a shorthand for 'while True'.)
I think your "should be compiled to" example was meant to be:
while True:
...
if not (cond):
break
is this issue open for work?
@rajpratyush No—I haven't decided on a good syntax for this yet.
I don't know if this is really necessary. Coconut markets itself as a superset of python aimed for functional programming, where do-while doesn't fit that much. Anyhow, I'd vote for the this syntax, as it's much more readable:
do:
...
while: cond