On Thu, Apr 17, 2008 at 6:53 PM, mm <[EMAIL PROTECTED]> wrote: > Rodrigo Palhano a écrit : > > > > On Tue, 15 Apr 2008 19:39:37 -0300, Zaher Dirkey <[EMAIL PROTECTED]> > wrote: > > > > > > > I use GO TO when teaching pascal, but after all i ask them to not use > it, it > > > just a bridge to learning the logic of programming language. > > > > > > There is another word i hate to use it it is EXIT. > > > > > > > I also understand EXIT as a bad programming practice, it makes life harder > for code readers. > > > > I don't ;-) Even Ada has an "Exit" instruction which one is better than > the Pascal one because, with Ada, "Exit" is a keyword. > > Using "Exit" is not of a bad programming practice. Suppose one has to > write a big procedure, say 150 lines of code. Suppose now that, instead > of writing
150 lines of code in procedure, should be move into smaller parts of code imho. But I believe in the motto of "die fast". As soon as you know that your code should not handle something, go away, don't continue your code, so exit have it uses. I think that every part of programming tools, have their use, the problem is the abusing of such tool, and using them even where there is no real use for it. > > if X = 0 then Exit; > > at the beginning of the procedure, one writes > > if X <> 0 then > begin > ... > > Does a reader immediately see that, when X = 0, the procedure does > nothing? No. They have to read all the code, to search for the "end" > that closes the "begin" in order to get sure there are no instructions > after this "end". In such a case, with the "Exit" instruction the > procedure is much easier to read. > > mm > ---- > http://www.ellipsa.net/ > > > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- http://ik.homelinux.org/
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal