Post Reply 
Python survey 2020
11-01-2020, 10:51 AM
Post: #4
RE: Python survey 2020
(11-01-2020 05:59 AM)Wes Loewer Wrote:  I know they won't add it, but Python could use a DO-WHILE or REPEAT-UNTIL ...

Assumed Python do have repeat/until:

repeat:
      ... # some code
      if condition: continue
      bad = 0
      ... # code that might turned "bad"
until bad

if condition is true, it will jump to line "until bad".
However, bad is a local variable, not existed before condition test.
(Or worse, bad existed outside repeat/until loop, and used for until ...)

You could solve it by moving up bad=0 before the condition test.
But, that would be messy to document repeat/until usage.

Static typed language does not have this problem. Code won't compile.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Python survey 2020 - compsystems - 10-30-2020, 02:25 PM
RE: Python survey 2020 - pinkman - 10-30-2020, 08:36 PM
RE: Python survey 2020 - Wes Loewer - 11-01-2020, 05:59 AM
RE: Python survey 2020 - Albert Chan - 11-01-2020 10:51 AM
RE: Python survey 2020 - toml_12953 - 11-01-2020, 04:45 PM
RE: Python survey 2020 - Dave Britten - 11-01-2020, 02:25 PM



User(s) browsing this thread: 1 Guest(s)