PDA

View Full Version : i ??



linque
August 30th, 2002, 01:11 AM
I've seen lots of code with "i" used.. such as


i++

or


if (i==20) {


what's i


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

:-\

telekinesis
August 30th, 2002, 01:16 AM
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!

lostinbeta
August 30th, 2002, 01:29 AM
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.

upuaut
August 30th, 2002, 01:44 AM
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.

lostinbeta
August 30th, 2002, 01:46 AM
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.

Bezzer
August 30th, 2002, 03:23 AM
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 :)

linque
August 30th, 2002, 03:29 AM
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 :)

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.

Bezzer
August 30th, 2002, 03:50 AM
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
:)

Kitiara
August 30th, 2002, 04:56 AM
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. :)

upuaut
August 30th, 2002, 05:33 AM
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. :)

pom
August 30th, 2002, 07:40 AM
Strangely enough, variables foo and bar are also very commonly used by programmers. Comes from FUBAR from what I've heard...

pom :asian:

upuaut
August 30th, 2002, 08:21 AM
really?? lol.. I've never seen that. maybe I'll start using those.

Bezzer
August 30th, 2002, 09:36 AM
i think the variable "foo" comes from chatting and stuff like that... :)

lostinbeta
August 30th, 2002, 10:13 AM
I have seen foo and bar a lot in javascript scripting and php scripting.

Mythmon
October 11th, 2003, 09:33 PM
i always thought that we used "i" because its ussually used to represent an Integer and j just cause i was being used already

ahmed
October 11th, 2003, 10:56 PM
Originally posted by lostinbeta
I have seen foo and bar a lot in javascript scripting and php scripting. since someone's bumped this thread, i might as well add this about Foo and Bar.. they're used on the programming community for illustration purposes, like saying "say you got function foo and function bar". Fubar comes from "F***ed Up Beyond All Repair", which from what i've read was used a lot back in the WWII days when talking about broken machinery or something... crazy stuff :beam:

lostinbeta
October 12th, 2003, 12:19 AM
Wow this thread totally makes me look like an idiot, but it was only 1 month after I have been actionscripting so idiots away.

And yes I learned what foo bar meant a while ago, but thanks for the update ahmed :thumb: