Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: $Revision: 1.6.2.13 $; site uiucdcs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!inuxc!pur-ee!uiucdcs!liberte From: liberte@uiucdcs.UUCP Newsgroups: net.lang Subject: Re: Re: Teaching students with GOTO - (nf) Message-ID: <26400011@uiucdcs.UUCP> Date: Sun, 20-May-84 04:58:00 EDT Article-I.D.: uiucdcs.26400011 Posted: Sun May 20 04:58:00 1984 Date-Received: Mon, 21-May-84 08:01:58 EDT References: <5806@mcvax.UUCP> Lines: 39 Nf-ID: #R:mcvax:-580600:uiucdcs:26400011:000:1664 Nf-From: uiucdcs!liberte May 20 03:58:00 1984 #R:mcvax:-580600:uiucdcs:26400011:000:1664 uiucdcs!liberte May 20 03:58:00 1984 Objection, your Honor. /**** uiucdcs:net.lang / steiny@scc / 6:21 pm May 19, 1984 ****/ When I took my first programming class Bill McKeeman (sp?) had a simple rule for the use of goto's in Alogol W - "...if anyone uses one they will fail the course." /* ---------- */ Now I am not a liberal user of goto's, but I do object to impossing this kind of rule unless there is a corresponding rule that the instructor will never give any assignments in which goto's may be used appropriately. What is "appropriate" use of a goto? There seem to be two cases. 1. Exiting from deep within a program on some error condition. The original Pascal compiler has such a goto on premature EOF and if such an exit is not provided in the language. 2. Exiting from multi-condition (and multi-nested) loops where the conditions may not all be evaluated and if such an exit is not provided in the language. Avoiding use of goto's in these cases requires the addition of often obscure boolean variables, assignments and testings all the way out to the exit point. For case 2, duplication of code may do the same. Sometimes greater clarity can be achieved, but not usually. In such cases, I have no qualms about using goto's. I can appreciate the problems of overuse of goto's having rewritten other peoples spaggetti (sp) code. But I have seen many students (including myself) struggling to figure out how to arrange a loop to exit properly when a goto (or exit) would have made things a lot simpler. Daniel LaLiberte (ihnp4!uiucdcs!liberte) U of Illinois, Urbana-Champaign, Computer Science {moderation in all things - including moderation}