GOTO considered potentially useful for teaching loops

@jonathanmiddleton I heard you talk about your difficulty with grokking loops as a programming concept. Having seen similar struggles in other beginning programmers, this got me wondering:

Would it have helped you if goto were introduced first, with while and for coming later as abbreviations of common goto usage patterns?

Of course I would be interested to hear from others as well.

That’s an intriguing idea.

Even though using GOTO is not recommended, it may be considered more explicit and so an easier way to really “see” what is happening in the code. Then, after introducing GOTO, looping can be taught, “And now here’s a way to do the same thing without needing a label!”. And GOTOs are still sometimes used sparingly in some languages, e.g., to break from an outer loop from within an inner loop.

I think it is at least worth considering.

Hey @MatthijsBlom

Thanks for bringing this up. I’d be really interested to dive into this. One of the big challenges I’ve found is that the terminology used in programming just doesn’t relate that easily to the concept that is actually at play.

Since I actually worked through some clearly worded instructions on what is actually happening in loops, I’ve managed to get a sense of what is going on but still it’s a bit fuzzy.

Do tell me more! Always keen to find out!

Do I understand correctly that you are not yet familiar with goto?

Which terminology in particular?

I’m not sure what to tell you. What do you wish to know?