C# for loops
Jakman (473)

In C# you will want to use for looping to make programming easier to do. This is how you will make a for loop to go through a number.

for (int i = 0; i < 10; i++){

Use the keyword 'for' to start the for loop. Then encapsulate its contents in parentheses like a method. after that you need to initialize an interger value and terminate it by semicolons like done in the example. Then state what the for loop should last for. I have made it to where it will last while i is less than 10. Terminate that with a semicolon and move on. Then you need to increment what you are going through. adding '++' by a number value in C# increments that value by 1. So this value will go up by 1 every time the for loop loops. Then in curly brakets you contain what you actually want to loop. Here i have made the console write out the value of the i variable.
It will have the output of this


If you have any questions ask me.
Thank you for reading.

You are viewing a single comment. View All
Jakman (473)

@08KINPLIX I was thinking of a math or scientific formula. What formula do you think it should be?