Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-3
Question by Wesley · Jul 16, 2010 at 03:54 PM · programming-basicsflagged-for-close

a lower case i?

I keep seeing a lower case i in scripts. I apologize if this is a trivial question but I have to ask: what does that lowercase i mean?

And if there is any case of source for learning Syntax things like that I would love a link.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Mike 3 · Jul 16, 2010 at 04:00 PM

Nothing really, it's generally just used as a basic index/count variable from languages such as C, and moved into newer languages - very often used in for loops:

for (int i = 0; i < 10; ++i)
{
    //do something using i
}

Generally (for js/c#), you should always use camel case for all variables, which is lower case for the first letter, then uppercase for the first letter in every word in the name afterwards

e.g.:

i myVariable myOtherVariable

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0
Best Answer

Answer by equalsequals · Jul 16, 2010 at 03:59 PM

I assume you are referring to something like this:

for(i = 0; i < someNumber; i++)
{
    //do something
}

"i" is just a variable, it is customary to call it "i" for "increment" or "int" but it can be anything. In that above code it just means:

As long as i, which starts at 0 is less than someNumber (another variable) keep firing the encapsulated code, And when it reaches the "}", end of encapsulation, increment "i" by 1 and repeat... Which is a for loop.

Hope that helps

==

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lipis · Jul 16, 2010 at 07:35 PM 0
Share

i is here actually stands for index :)

avatar image equalsequals · Jul 16, 2010 at 08:40 PM 0
Share

Back when I learned program$$anonymous$$g years ago I was taught to think of it as integer because you are only working with a whole number. Index only makes sense if you are recursively moving through array indexes or something similar, but 'i' for int always makes sense. Alternatively since you are incrementing it, 'i' for 'increment' also makes sense. Way easier to remember in my book. :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Referencing variables / functions on another script 1 Answer

Block programming for Kid 1 Answer

Deleting animation curve with editor script 1 Answer

unity web player startup 0 Answers

us of the "as" keyword (Instantiate, GetComponent) 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges