www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/27/18:18:42

From: "Ryan McGee" <rdm AT IHate DOT spam>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: goto statement and labels
Date: Fri, 27 Feb 1998 15:56:53 -0600
Organization: InLink
Lines: 42
Message-ID: <6d7clh$1nl$1@news1.inlink.com>
References: <3 DOT 0 DOT 5 DOT 32 DOT 19980225212841 DOT 007c1450 AT pop DOT iquest DOT net> <34F714DE DOT 5C44F298 AT evitech DOT fi>
NNTP-Posting-Host: iits01114.inlink.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Erno Tuomainen wrote in message <34F714DE DOT 5C44F298 AT evitech DOT fi>...
>Ricki Lee King wrote:
>>
>> how do i do this?
>>
>> label;
>> expression;
>> goto label;


You came pretty close thought, you would do it by doing this:
Label:              //Notice the colon, not simicolon
<expressions>
goto Label;

>
> Sorry, no answer for your question but...
>
> ...please *do not* use goto command in your programs. It's very bad
>programming style and it makes the program much harder to
>understand/debug. Use functions instead.


Not quite so, for some instances, like at the end of a game when you ask if
you wanna play again, you can't really use a function to go back to the
start of your program, and a while loop is very cumbersome and it doesn't
decrese the redability of the code as long as you use VERY FEW labels/gotos.

>
>
>--
>Erno Tuomainen                   void hello(void)

>ernomat AT evitech DOT fi                  while(1) printf("Hello
>Linux!\n");
>http://www.evitech.fi/~ernomat   }


Ryan
RDM AT Inlink DOT com


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019