Re: how do people feel about exit function from loop
- From: dpb <none@xxxxxxx>
- Date: Mon, 30 Jul 2007 12:43:06 -0500
Ralph wrote:
"Larry Serflaten" <serflaten@xxxxxxxxxxxxxx> wrote in message
news:OArXqJs0HHA.3916@xxxxxxxxxxxxxxxxxxxxxxx
"Steve Gerrard" <mynamehere@xxxxxxxxxxx> wroteused with
* Does the loop index have a meaningful name?Does "n" count as a meaningful name? :)
I use single letter variables almost exclusively as for loop indexesletter forarrays, so to me it is.
You must be one of those GenX coders, eh? <g> I come from an era when
3 was the magic number for characters in a variable name. idx (index),
itm (item), row & col, etc... About the only time I'd use a single
an iterator would be for referencing X and Y coordinates and theoccasionalthrow-away test routines.
I use idx 'n such, mainly because it always seemed more readable and more
amendable for search 'n replace. But then I occasionally side to the dark
side and use i% and n&. <g>
Almost nothing I hate more than something like
my_wonderfully_named_array(uselessly_described_index) = _
my_wonderfully_named_array(uselessly_described_index) + _
your_wonderfully_named_array(uselessly_described_index-1)+1
:(
Unless there's a really solid reason for otherwise in a specific application, indices of For...Next loops _should_ be brief and the traditional i,j,k,..., etc. Offhand, I have a hard time of thinking of a place that does justify the use of the longer name that tends to obfuscate more than clarify.
If there's any doubt at all of the intent or the reason for the iterator being the values it takes on, a comment adds that explicitly and doesn't distract further from the code itself.
In VB for deep or long loops I either make sure to declare them as Long or do use the "&" for the performance gain of the Long over the Integer.
imo, ymmv, $0.02, etc., ...
--
.
- Follow-Ups:
- Re: how do people feel about exit function from loop
- From: Robert Morley
- Re: how do people feel about exit function from loop
- References:
- how do people feel about exit function from loop
- From: greg
- Re: how do people feel about exit function from loop
- From: Ken Halter
- Re: how do people feel about exit function from loop
- From: Jan Hyde (VB MVP)
- Re: how do people feel about exit function from loop
- From: Steve Gerrard
- Re: how do people feel about exit function from loop
- From: Michael C
- Re: how do people feel about exit function from loop
- From: Robert Morley
- Re: how do people feel about exit function from loop
- From: Michael C
- Re: how do people feel about exit function from loop
- From: Robert Morley
- Re: how do people feel about exit function from loop
- From: Michael C
- Re: how do people feel about exit function from loop
- From: Robert Morley
- Re: how do people feel about exit function from loop
- From: Michael C
- Re: how do people feel about exit function from loop
- From: Robert Morley
- Re: how do people feel about exit function from loop
- From: Michael C
- Re: how do people feel about exit function from loop
- From: Robert Morley
- Re: how do people feel about exit function from loop
- From: dNagel
- Re: how do people feel about exit function from loop
- From: Robert Morley
- Re: how do people feel about exit function from loop
- From: dNagel
- Re: how do people feel about exit function from loop
- From: dNagel
- Re: how do people feel about exit function from loop
- From: Steve Gerrard
- Re: how do people feel about exit function from loop
- From: Larry Serflaten
- Re: how do people feel about exit function from loop
- From: Ralph
- how do people feel about exit function from loop
- Prev by Date: Re: Case expressionlist-n
- Next by Date: Re: Deployment under Vista
- Previous by thread: Re: how do people feel about exit function from loop
- Next by thread: Re: how do people feel about exit function from loop
- Index(es):
Loading