Xref: utzoo misc.misc:5955 comp.misc:5958 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!ukc!etive!lfcs!jha From: jha@lfcs.ed.ac.uk (Jamie Andrews) Newsgroups: misc.misc,comp.misc Subject: Re: The "evil" GOTO (Was: 25 Years of BASIC) Message-ID: <1932@etive.ed.ac.uk> Date: 5 May 89 10:54:10 GMT References: <1791@ubu.warwick.UUCP> <1436@onion.reading.ac.uk> <1814@ubu.warwick.UUCP> Sender: news@etive.ed.ac.uk Reply-To: jha@lfcs.ed.ac.uk (Jamie Andrews) Organization: Edinburgh University Computer Science Lines: 26 In article <1814@ubu.warwick.UUCP> mirk@uk.ac.warwick.cs (Mike Taylor) writes: >Why make the test twice? Huh? Huh? Answer me that, all you obsessed >anti-GOTO campaigners. The *natural* way to express the above is: > > printf ("Enter your sex: "); >LABEL: gets (sex); > if (sex != "m" && sex != "f") { > printf (" or only: "); > GOTO LABEL; > } Death to GOTO! printf ("Enter your sex: "); while (1) { gets (sex); if (sex == "m" || sex == "f") break; else printf (" or only: "); } Long live break! --J.