gettingstarted
[Top] [All Lists]

Re: Exit For-Next using Return ?

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Exit For-Next using Return ?
From: Russ Jones <russ dot jones at computer dot org>
Date: Sun, 24 Apr 2005 08:47:07 -0400
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <001a01c5484d$5dc2b410$1a974154 at newa8bavxwdlz0> <426B7EDC dot 2E70528A at online dot no>
Hi Eric.

Return should work for you just fine, without any ill effects.
Any loop counters or local variables should be kept on the stack, which will be cleaned up by the return. As you point out, "return" will indeed return control right out of the method you are in, to the calling code.

Russ

On Apr 24, 2005, at 7:11 AM, Eirik Karlsen wrote:

I know one should Exit for early termination of a For-Next loop..but it won't quite fit into my code.

Is it safe to use Return instead to get out of the loop and out of the sub...or could that cause nasty things like stack overflow, memory leak, or instability of any sort?


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>