Hairy Pixels via fpc-pascal said on Tue, 20 Jun 2023 14:05:04 +0700 >> On Jun 20, 2023, at 1:10 PM, Steve Litt via fpc-pascal >> <fpc-pascal@lists.freepascal.org> wrote: >> >> I can still make a good argument for what my professors taught me, >> but in the intervening years, I found break and especially continue >> wonderful for increasing readability. > >Educators continuously have stupid ideas that don't work out as >intended in the real world. I would love to see them make a real >program that does something difficult and not use early breaks. > >I assume them they forbid early exits in functions also or is the loop >special for them?
I'd have to take a time machine back to the early 1980's to find out their opinions on early function exit, but judging from their underlying philosophies I'd guess they'd have a problem with early exits from functions. Their tude isn't completely stupid if you look at it from the viewpoint of the early 1980's. Flowchart-designed spaghetti code and the proud and stubborn spaghetti chefs creating it were still very prevalent, resulting in programs increasingly difficult to bring to completion, modify or maintain. By FAR my educators' priority was to teach us modular programming: 1 entry point, 1 exit point, no global variables, no gotos, no goto-lights (break, continue, exit). With what they taught us young turks, we went out and replaced the spaghetti chefs everywhere except the mainframe. As we young turks got some experience, we realized the orthodoxy we learned in school wasn't necessary. We realized that in 30 line loop body, putting three continue statements at the top was a heck of a lot more readable than three levels of indentation. We realized that in a 30 line loop body, with multiple things being able to stop the loop and not just a counter, sometimes a break statement was more readable than a monstrosity logic part of the while statement, and all the if statements to prevent certain parts from being executed. So yeah, we used some stupid ideas in the real world, but those stupid ideas completely eliminated spaghetti programming, so our super-productivity displaced the spaghetti guys, giving us some time to moderate the orthodoxy with common sense. One of the things I truly appreciated about Pascal was that it not only promoted modular programming, but it also made it difficult to spaghetti. It was a long time ago, but if I remember correctly the Whitesmith Pascal and Turbo Pascal 2 and 3 had either break or continue. If I remember correctly, I first learned about those when learning C. Thanks, SteveT Steve Litt Autumn 2022 featured book: Thriving in Tough Times http://www.troubleshooters.com/bookstore/thrive.htm _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal