On Monday 13 June 2005 08:07, Nick Coghlan wrote: > Raymond Hettinger wrote: > > [BJörn Lindqvist] > > > >>I would like to have do-while's like this: > >> > >>do: > >> <body> > >> until <cond> > >> > >>But I'm sure that has problems too. > > > > That looks nice to me. > > And this could easily be extended to allow code both before and after > the 'until', giving a fully general loop: > > do: > <body-1-or-more-times> > until <cond> > <body-0-or-more-times> > else: > <on-natural-loop-exit> > > In fact, this would simply be giving "looks like executable > pseudocode" syntactic sugar for the current 'do-until' workarounds: > > while 1: > <body-1-or-more-times> > if <cond>: > <on-natural-loop-exit> > break > <body-0-or-more-times> Yet another way to spell this would be make the default for the while statement be true so the 1 could be omitted and then add a condition to break. while: <body-1-or-more-times> break <cond>: <on-natural-loop-exit> <body-0-or-more-times> I think this would be feature creep. It complicates the language for a very small gain. While the added syntax would be intuitive, it only saves a line or two over the existing syntax.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4