i ??

I’ve seen lots of code with “i” used… such as



if (i==20) {

what’s i

??? It’s not in flash mx actionscript dictionary, nor in the books I’m trying to learn…


Its just one of those variable names that everyone likes to use when using integers as the data (numbers). The ‘i’ could be replaces as anything, its just the name that they choose to use!

Haha, ironically I posted a thread with the exact same question. i and j seem to be very popular variables. It seems that if i is already a used up variable, j is the next in line.

I just think of i as meaning “<B>I</B>nternational Variable” Because it is used everywhere.

As for j, I have no clue. Hmmm, maybe I will think of it as meaning “<B>J</B>ust in case i is used”. Yeah, that sounds good:) But you didn’t ask about j, so you can ignore this if you want, but just in case you start to see it a lot more later on, you will know.

I just avoid a,b,c,x,y,z because they are usually used as coordinates for movement and location… From there I start with i because everyone else uses it… and move my way down.

I’ve actually had code where I made it all the way to “p”… but 8 variables was the max I’ve ever needed in a single function.

Wow, I haven’t used more than like 3 variables.

When I did programing on my graphing calculator at school I used the variables A, B, and C to label matrices. I see a lot of arrays and matrices labeled with these letters too.

It is sort of like an unwritten rule or something.

well the variables “i”, “j” ect were used in the old days of computers… now its just normal that when someone does a for next loop they use the variable “i”.

Heh i cant exactly remember the history behind it but it goes back to one of the programing languages…i’ll look into it :slight_smile:

wow… thank you all…

it’s nice to get so many responses… I’m so new at this … I never know when my question is tooooo off the wall or within reason :slight_smile:

I suppose using “i” or… “j” as you mention must have grown up within the flash community, and probably from the programming community as you sited.

I guess it’s not in my books and, I didn’t see it in the help files, since variables are ?? authored by each person… oh well…rhetorical question, and thanks for the thorough answers.

well “i” was a variable that actualy that was used way before flash but its been adopted into most of the programing languages as the variable you use in for next loops

When I was first learning programming, many years back, my old teacher used to use x as the variable / counter name. Think he came from a maths background, as they use x in equations a lot…

But now i seems to be the norm, mainly because we’re now fiddling around with co-ordinates and to have variables like _x as well as x would confuse the hell out of me, for one. :slight_smile:

oh yeah… and most people opt to not use o l and a couple others because of their close resemblance to 0 and 1. I do remember reading that somewhere.

as for the question being off the wall linique… I’ll tell you I think I’ve seen this question asked 4 times since we opened up the new forum. It’s a common one. :slight_smile:

Strangely enough, variables foo and bar are also very commonly used by programmers. Comes from FUBAR from what I’ve heard…

pom :asian:

really?? lol… I’ve never seen that. maybe I’ll start using those.

i think the variable “foo” comes from chatting and stuff like that… :slight_smile:

I have seen foo and bar a lot in javascript scripting and php scripting.