These forums are CLOSED. Please visit the new forums HERE
How do you name your counters? |
|
Hiro Pendragon
bye bye f0rums!
![]() Join date: 22 Jan 2004
Posts: 5,905
|
02-22-2005 11:31
I'm a geek. I want to know how you name your counters!
_____________________
Hiro Pendragon
------------------ http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio Visit my SL blog: http://secondtense.blogspot.com |
Brian Mifflin
Scripting Addict
Join date: 15 Dec 2004
Posts: 182
|
02-22-2005 11:38
Always seems to be x,c, or i for me.
|
Adam Zaius
Deus
![]() Join date: 9 Jan 2004
Posts: 1,483
|
02-22-2005 11:39
integers: i,j,k,l
floats: w,x,y,z -Adam _____________________
|
Hiro Pendragon
bye bye f0rums!
![]() Join date: 22 Jan 2004
Posts: 5,905
|
02-22-2005 11:40
I may add that for any simple loop, 9/10 times I will use "c". There's something holy and pure about having "c++" in the FOR command. *grins*
_____________________
Hiro Pendragon
------------------ http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio Visit my SL blog: http://secondtense.blogspot.com |
Tiger Crossing
The Prim Maker
![]() Join date: 18 Aug 2003
Posts: 1,560
|
02-22-2005 11:59
I only use single-letter variables in FOR loops, starting with 'a' and moving through the alphabet. I also use '++a' instead of 'a++' in the FOR loop statement since it is slightly faster. (It doesn't have to make a temporary variable like the postfix version does. If you don't need it, why make it?)
All my globals start with lowercase 'g', use first-letter-caps and no underlines. My local variables are all lowercase with underscores separating words. Functions are like globals but without the 'g' prefix. Parameters are also like globals but with 'a' instead of 'g'. (I don't always do this.) Any counting variable not part of a FOR statement line uses a descriptive name. ( ex: 'gAvatarCount' or 'line_num' ) _____________________
~ Tiger Crossing
~ (Nonsanity) |
Strife Onizuka
Moonchild
![]() Join date: 3 Mar 2004
Posts: 5,887
|
02-22-2005 12:21
I'm lazy and the less i have to type the better (and the more i can fit on the screen at once). I find it hard to grok scripts that have more comments then code (I don't care what you say it does just get on with it, and let me see what it does).
Anyways for junk variables I use letters. Junk variables being temporary variables, paramaters passed from an event or variables in short scripts. I usualy a -> n when i'm too lazy to figure out which ones are available for use i'll pick one randomly from p and up. w in most of my scripts is resereved as a global integer (or list) containing listen handles. I don't know why i use w for this, always have. rarely i'll use other lettered global varriables. In most scripts i use lettered variables I did not have the intention of releasing them to the public. _____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
Flyingroc Chung
:)
Join date: 3 Jun 2004
Posts: 329
|
02-22-2005 12:29
i, j, k mostly.
sometimes ctr. If I'm moving through positions on a list, I use pos, or index, or (rarely) idx. Sometimes I just use the letter that comes to mind first. *** EDIT *** ok, so sometimes what we say is different from what we do ![]() I took a look at 5 scripts of mine that I thought represented the kind of scripting I usually do. Within those five scripts, I used some looping construct 10 times, 8 of them used the variable "i" for the counter. The other two were "deck_pos" and "letter_at". |
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
02-22-2005 13:17
general counters, like for loops, i, j, k etc.
Other counts, something short but descriptive, especially if I am going to use it in several places. len, texcount etc. |
Huns Valen
Don't PM me here.
![]() Join date: 3 May 2003
Posts: 2,749
|
02-22-2005 15:42
comedy cx answer because I like assembly
_____________________
|
Moleculor Satyr
Fireflies!
![]() Join date: 5 Jan 2004
Posts: 2,650
|
02-22-2005 16:11
If it's intended to be nothing but a basic for counter, I use a, b, c.
Other things get full descriptive names. _____________________
</sarcasm>
|
Damanios Thetan
looking in
![]() Join date: 6 Mar 2004
Posts: 992
|
02-22-2005 17:05
basically t
will extend to t1,t2,t3 etc... Maybe because i am dutch, and although i script/code in english, this has been very old trait of mine (cbm 64). And the dutch word for counter is 'teller'. |
Elle Pollack
Takes internets seriously
![]() Join date: 12 Oct 2004
Posts: 796
|
02-22-2005 17:08
I use i or x almost all the time because that's what the wiki examples use. ^.^;
|
Alondria LeFay
Registered User
![]() Join date: 2 May 2003
Posts: 725
|
02-22-2005 18:26
i, j, k, or sometimes just a generic foo.
|
Byron McHenry
Registered User
Join date: 21 Sep 2004
Posts: 204
|
02-22-2005 18:48
most people were taught single leters for time restraints but its better for debugging purposes to use more descriptive variables.
|
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
|
02-22-2005 18:49
I seem to use 'x'. Probably due to the magazines which published "type-in" programs during my Atari 800 and Apple IIe days. Wish I'd saved some of those mags now. Though I've probably used descriptive variables in more complex scripts.
|
Ardith Mifflin
Mecha Fiend
Join date: 5 Jun 2004
Posts: 1,416
|
02-22-2005 18:52
Though I was taught to use i, j, k, etc. when I first learned to code in C++, and I maintained this practice when cobbling together code in Fortran, I've since been influenced by mathematics and usually use n first, and then i, j, and k. Though explanatory naming greatly improves the readability of code, there's something I find awkward about having such long variable names.
|
Strangeweather Bomazi
has no clever catchphrase
Join date: 29 Jan 2005
Posts: 116
|
02-22-2005 19:47
most people were taught single leters for time restraints but its better for debugging purposes to use more descriptive variables. I think descriptive names for disposable loop variables are vastly overrated. For meaningful variables, sure. _____________________
Strangeweather Designs - classic casual home furnishings
Now open in Mochastyle, Mocha (13, 115) |
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
02-22-2005 20:53
The only time you will see a one-letter, totally undescriptive variable in my scripts is when it is being used for a for loop iterator over some collection of items (like a list, or object inventory). I really try to avoid modifying the iterator in the for loop (that's what the i++ is for
![]() ==Chris |
Carnildo Greenacre
Flight Engineer
Join date: 15 Nov 2003
Posts: 1,044
|
02-22-2005 23:20
integers: i,j,k,l floats: w,x,y,z Fortran, right? I use i, j, k, l, m... for generic loop iterators, w, x, y, z for coordinate iterators. If a loop counter has some meaning other than "index", I base the variable name on that. For other variables, if it's a global, it begins with "g". If it's supposed to be constant, it begins with "c". _____________________
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++;'
|
Kyrah Abattoir
cruelty delight
![]() Join date: 4 Jun 2004
Posts: 2,786
|
02-23-2005 00:18
i use usually i and j for my for loops , declared as global variables so i dont need to redefine em all the time
_____________________
![]() tired of XStreetSL? try those! apez http://tinyurl.com/yfm9d5b metalife http://tinyurl.com/yzm3yvw metaverse exchange http://tinyurl.com/yzh7j4a slapt http://tinyurl.com/yfqah9u |
Eggy Lippmann
Wiktator
![]() Join date: 1 May 2003
Posts: 7,939
|
02-23-2005 02:55
i,j,k in for loops.
When I actually care about the resulting count, I will name it numBlah as in "number of Blahs". _____________________
|
Hank Ramos
Lifetime Scripter
![]() Join date: 15 Nov 2003
Posts: 2,328
|
02-23-2005 03:53
If it's for a loop: i, x, y, z
For anything else, I use a full name describing it's purpose. For a generic global counter I use: counter ![]() |
Jillian Callahan
Rotary-winged Neko Girl
![]() Join date: 24 Jun 2004
Posts: 3,766
|
02-23-2005 04:16
For a generic global counter I use: counter ![]() That's counter intuitive. </rimshot> _____________________
|
Issarlk Chatnoir
Cross L. apologist.
![]() Join date: 3 Oct 2004
Posts: 424
|
02-25-2005 09:28
i,j,k or cur<name of thing>
_____________________
Vincit omnia Chaos
Anyway, ignore me, just listen to the cow |
Cross Lament
Loose-brained Vixen
![]() Join date: 20 Mar 2004
Posts: 1,115
|
02-25-2005 15:09
'i'. Just, 'i'.
On an unrelated note, can anyone tell me why my script logic keeps breaking? I can't figure it out. ![]() Okay okay, I'm lying. But I do use 'i' and sometimes 'j' for generic for-loop counters. If it's being used to store an actual, useful value, then I give it a pretty, descriptive name, like 'fluffy'. ![]() _____________________
- Making everyone's day just a little more surreal -
Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?" |