Re: goto
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 16, 2001
- 496 views
[Slightly off-topic] I remember reading an article in which the author was responding to the idea that the use of goto in a program causes "spaghetti" code and nobody could understand what was happening. This author responded with a beautifully structured program that had no goto and was equally incomprehensible. It went along the lines of ... constant EndProgram = -1 integer State State = 0 while not EndProgram do if State = 0 then <do something> State = 6 elsif State = 1 then <do something> State = 7 elsif State = 2 then <do something> State = 5 elsif State = 3 then <do something> State = 4 elsif State = 4 then <do something> State = 1 elsif State = 5 then <do something> State = 3 elsif State = 6 then <do something> State = 2 elseif ... etc... else State = EndPRogram end if end while ----------- cheers, Derek Parnell Senior Design Engineer Global Technology Australasia Ltd dparnell at glotec.com.au --------------------- confidential information intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient of this message you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify the sender immediately. Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Global Technology Australasia Limited.