Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cetron From: cetron@wasatch.utah.edu (Edward J Cetron) Newsgroups: comp.misc Subject: Re: The "evil" GOTO (Was: 25 Years of BASIC) Message-ID: <1826@wasatch.utah.edu> Date: 15 May 89 00:32:13 GMT References: <1791@ubu.warwick.UUCP> <1436@onion.reading.ac.uk> <1814@ubu.warwick.UUCP> <698@occrsh.ATT.COM> <852@umecs.cs.umu.se> <912@twwells.uucp> Organization: Morrison-Knudsen, Industrial Buildings Division, SLC, UT Lines: 36 In article <912@twwells.uucp> bill@twwells.UUCP (T. William Wells) writes: >And if one insists on not putting this into its own function (making >the return improper): > > for (i = 0; i < N; ++i) { > for (j = 0; X[i][j] == 0; ) { > if (++j == N) { > printf("The first all-zero row is %d\n", i); > break; > } > } > if (j == N) { > break; > } > } > >One could, of course, turn the first break into a goto, but >eliminating the possible cost of the j == n test isn't worth the loss >of clarity. AHA! But what if it WAS a function? And what if it was some sort of very heavily used function? In THAT case wouldn't that fact that you saved that extra useless code be worth something? Maybe, maybe not. But if you understand your application, and you understand WHY structured programming, THEN, AND ONLY THEN, could you properly decide which is better. And that is my whole point - let's teach how to understand the problem and solve it correctly - not simply by-the-book. And to those who change the code to make it more user-friendly than the original - HURRAH. It is the function of the code, not its exact flow of control which is important. To those who bitched that the improved code didn't exactly translate to the original - you missed the whole damn point. -ed cetron