# Thread: [Sequel][TUT] How to script part 4

1. ## [Sequel][TUT] How to script part 4

Today, we will learn about for statements. Note: this will be long.
1. For with variables. for with variable can be used for just about anything! heres a finished example code:
Code:
`for( i = 0; i <= 12; i++ )`
Now, I will explain all of the code to better understand it.
1a. Are variable 'i' will be set to the value of 0 and is ended with a semi-colon.
2a. Are variable 'i' is being questioned if it is less than or equal to 12 and finally is ended by a semi-colon
3a. Are variable 'i' will be counted up until reaching 13 repeating the script the variable is used for for 13 times.
2. How to edit a for statement the variable letter or name can be edited to you liking like this:
Code:
`for( variable = 0; variable <= 12; variable++ )`
2a. The equal to or less than. You can replace these with the following: ( <=, >=, ==, != ) Note: the '!' represents "not" as well the number after the equal and what not.
3a. Adding Subtracting. You can add or subtract ( variablename++, variablename-- )
4. Loops with the for statement. You can make a script repeat at a location infinite times with:
Code:
`for(;;)`
Notice, that the two semi-colons inside are used because of the two ending's on the for statement with variables.
Hope you liked it.

0

2. Terrible waste of a thread

0

3. Good work! I just think you should use examples, I know this stuff,
but for others. When you say
for( ;; ) they get confused, you should say something like:

credit()
{
for( ;; )
{
self iprintlnbold("Loop made by ^3CheeseToast :P");
wait 30;
}
}

0

4. Wouldn't it be an if statement though? like if i is less than 13 ++?

0

5. no. and actually some people want to learn all of this so why do you hate.

0

6. mynameisjosh, It's a for thingy but not a loop, every time it goes through it adds 1 or subtracts 1 or whatever,
then the middle part is like an if, so if variable is less then or equal to 12, it adds one.
The first part is just saying what the variable equals.

0

7. Originally Posted by CheeseToast
mynameisjosh, It's a for thingy but not a loop, every time it goes through it adds 1 or subtracts 1 or whatever,
then the middle part is like an if, so if variable is less then or equal to 12, it adds one.
The first part is just saying what the variable equals.
Exactly the point I was trying to make!

0

8. I know, but I was just re explaining because your main post didn't make sense to him.

0

9. Originally Posted by CheeseToast
I know, but I was just re explaining because your main post didn't make sense to him.
It's alright man.. I'm gonna apply for coder one last time..

0

10. Thanks cheese. and Newtohacking

0

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
All times are GMT -10. The time now is 12:02 PM.