by joatmon-snoo · 5y ago · 0 comments
while True:
...
if condition:
break
...
and kinda wish there was a nicer syntax for this. loop
while!(condition);
...
end;
for while, versus loop
...
while!(condition);
end;
for do-while, and loop
...
while!(condition);
...
end;
in place of: while True:
...
if not condition:
break
...
Alas, it never really took off.If it existed, I’d be tempted to suggest a linter rule that prohibits break inside an until (it should only be used when the main exit condition is the only exit condition.)
let foo = loop {
// ...
if condition {
break value;
}
// ...
}