3 ms·
I guess similarly to C: for i in foo: print(42) would be considered equivalent to something like it = iter(foo) while True: try: i = next(it
by tveita 11y ago
I guess similarly to C:
for i in foo:
print(42)
would be considered equivalent to something like
it = iter(foo)
while True:
try:
i = next(it)
catch StopIteration:
break
print(42)
and jumping to print(42) would skip the init and first iteration expression.
Of course that's non-obvious behaviour, so in practice you would make it a compile time error. A careful language designer might even decide to not support goto at all. :)