? Why is I so commonly used for FOR loops? (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
Space-Restriction Challenge QSP Phase Ends on March 26!

Why is I so commonly used for FOR loops?

  • #1 ✎ 609 IAmRalsei Forum Leader Hidden Achievements First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength What I mean is when someone wants a FOR loop to loop 5 times, 99 times out of 100, They'll make their code look like this: FOR I=1 TO 5 [code goes here] NEXTWhen in reality, the value doesn't have to be I, so it could also be written like this:FOR CATS=1 TO 5 [code goes here] NEXTThis is just really strange. Posted
  • #2 ✎ 167 MochaProbably Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Drawing I like to draw! Hobbies I stands for Iteration so it only makes sense to use it, and its usually not used as anything else for consistency, but theres nothing stopping you from using it. Posted
  • #3 ✎ 609 IAmRalsei Forum Leader Hidden Achievements First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength
    I stands for Iteration so it only makes sense to use it, and its usually not used as anything else for consistency, but theres nothing stopping you from using it.
    Oh. That makes sense.
    Posted
  • #4 ✎ 1695 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself If you try to use actual names it usually gets annoying For example: DIM NAMES$[10] FOR NAME=0 TO 10-1 PRINT NAMES$[NAME] IF NAME == "John" THEN ... 'oops NEXT It's easy to make mistakes where you accidentally use the index variable instead of the value. Posted
  • #5 ✎ 609 IAmRalsei Forum Leader Hidden Achievements First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength
    If you try to use actual names it usually gets annoying For example: DIM NAMES$[10] FOR NAME=0 TO 10-1 PRINT NAMES$[NAME] IF NAME == "John" THEN ... 'oops NEXT It's easy to make mistakes where you accidentally use the index variable instead of the value.
    Okay, and please close this
    Posted Edited by IAmRalsei
  • #6 ✎ 974 Yttria Head Admin other reasons: there was once a time when dinosaur languages existed where only a few characters were significant in variable names. some of those languages had particular letters used for implicit typing. most of computer science comes from mathematics, where single-character identifiers are the norm. Posted
  • #7 ✎ 259 ProKuku Avatar Taboo I didn't change my avatar for 180 days Website Final(?) Contest Runner Up I placed 2nd in the (possibly) final SmileBASIC Source Contest! October 2018 Programming Contest Cthulhu Join the cult Easter Eggs
    Okay, and please close this
    Why do you always seem so keen to close a thread? I’ve noticed you like to make a thread and then tell an admin to just close it after three people make a comment.
    Posted
  • #8 ✎ 609 IAmRalsei Forum Leader Hidden Achievements First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength
    Okay, and please close this
    Why do you always seem so keen to close a thread? I’ve noticed you like to make a thread and then tell an admin to just close it after three people make a comment.
    Because there's no reason to keep a thread open after the question was answered.
    Posted
  • #9 ✎ 433 MasterR3C0RD Helper Received for being very helpful around SmileBASIC Source Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself
    Okay, and please close this
    Why do you always seem so keen to close a thread? I’ve noticed you like to make a thread and then tell an admin to just close it after three people make a comment.
    Because there's no reason to keep a thread open after the question was answered.
    Yes there is. Other people might have the same question, and may have additional questions on this subject. Why stifle future conversation before it starts?
    Posted
  • #10 ✎ 125 amihart I see the same notation used in mathematics a lot, like vector calculus and linear algebra, i, j, and k are used as well. Such as, if you have a matrix X, you might represent a single element in the matrix as xij where i is your row and j is your column. If you are looping through a matrix, you can also use that same notation. DIM X[10,10] FOR I = 0 TO 9 FOR J = 0 TO 9 PRINT X[i,j] NEXT NEXT Posted
  • #11 ✎ 1695 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself *Why am I so commonly used for FOR loops? Posted
  • #12 ✎ 609 IAmRalsei Forum Leader Hidden Achievements First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength
    *Why am I so commonly used for FOR loops?
    lol
    Posted