asd106
13-05-2004, 11:54 AM
In this tutorial I will teach you the following:
- What is (For)
- Why use it?
- How is it used
- Examples on it
What is (For)?
(For) is one of the ways to use the looping. With it you can save a lot of time instead of writing the code 15 times, by this looping you can write only one code that means 15.
Why use it?
Use it to save time in writing and even if you want to update the program you just update only one line and the looping will update the rest.
How is it used?
The statement is For var = int to int. the var is stand for variable int is stand for integer.
Examples on it
Example 1
For i = 0 to 15
Msgbox “It has been looped for ” & i
Next i
I will translate the code into pure English: it means that loop 16 times and each time declare a message box saying “It has been looped for ” and insert in the end of the message box the value of the variable i.
Example 2
To use it with List
For i = 0 to List1.listCount – 1
MsgBox “You are at this entry ” & List1.List(i)
Next i
In pure English: it means that loops through every entry in the list box and then declare a message box saying that “You are at this entry ” and in the end the view the entry the loop is in to.
Many, many, many, many, many more examples are on the way if you vote for me
Best regards to all
- What is (For)
- Why use it?
- How is it used
- Examples on it
What is (For)?
(For) is one of the ways to use the looping. With it you can save a lot of time instead of writing the code 15 times, by this looping you can write only one code that means 15.
Why use it?
Use it to save time in writing and even if you want to update the program you just update only one line and the looping will update the rest.
How is it used?
The statement is For var = int to int. the var is stand for variable int is stand for integer.
Examples on it
Example 1
For i = 0 to 15
Msgbox “It has been looped for ” & i
Next i
I will translate the code into pure English: it means that loop 16 times and each time declare a message box saying “It has been looped for ” and insert in the end of the message box the value of the variable i.
Example 2
To use it with List
For i = 0 to List1.listCount – 1
MsgBox “You are at this entry ” & List1.List(i)
Next i
In pure English: it means that loops through every entry in the list box and then declare a message box saying that “You are at this entry ” and in the end the view the entry the loop is in to.
Many, many, many, many, many more examples are on the way if you vote for me
Best regards to all