2 ms·
How would you expect the second one to work?
by RussianCow 11y ago
How would you expect the second one to work?
- tveita 11y agoI 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. :)