🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #14641

Re: Your Openion needed.

#14641
From: Philippe VENTRILLON
Date: Mon, 09 Aug 1999 00:00
44 lines
1869 bytes
My Opinion is that a loop should be ended only by it's exit condition. Not
because it works better but because it's easyer to read. I suppose that the
program you wrote works fine but I'd prefer write something like :

public boolean dummy()
{
    for(a=0; a<x && a!=b; a++)
    {
        // everithing you want exept break, continue and return
    }
    return (a==b);
}

Anyway you'll find cases where the source is easyer to understand with some
break into the loop. It always depends on the problem you are solving. But my
fisrt approach is without break and return.

Philippe VENTRILLON


Dillan Fernando wrote:

>  Hi,
>
> I usually use the following method to exit for loops
>
> public boolean dummy()
> {    for(a=0;a<x;a++)
>     {    if (a==b) return true
>     }
> return false;
> }
>
> I just want to know whether this a good practice. I have never run into any
> problems, Will there be a mem de-allocation problem or anythink like that ?.
>
> Thanks in Advance
>
> Kind Regards
>
> Dillan

--
Pour que votre reponse me parvienne, mettez VENTRILLON dans le sujet.
Technical Details
Message-ID: <37AEA356.E7B557DF@sab2i.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7oksdc$5pa2@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,ead9ef4a7993b06e
X-Google-Attributes: gidf74b3,public
From: Philippe VENTRILLON <philippev@sab2i.com>
Subject: Re: Your Openion needed.
Date: 1999/08/09
Message-ID: <37AEA356.E7B557DF@sab2i.com>
X-Deja-AN: 510852380
Content-Transfer-Encoding: 7bit
References: <7oksdc$5pa2@forums.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@wanadoo.fr
X-Trace: wanadoo.fr 934243215 20769 193.250.16.35 (10 Aug 1999 00:00:15 GMT)
Organization: Wanadoo, l'internet avec France Telecom
Mime-Version: 1.0
Reply-To: sabocean@wanadoo.fr
NNTP-Posting-Date: 10 Aug 1999 00:00:15 GMT
Newsgroups: borland.public.jbuilder.java.language