• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.
    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

C# Repeat a for loop infinite times

D

Deleted member 613

Guest
C#:
for (int counter = 0; counter < 10; counter++)
            {

            }

This will repeat 10 times because: counter = 0 at the start. While counter is less than ten, the for loop gets repeated, and counter gets increased by one. Once it gets to 11 it'll stop.
Another easy way is with do while loops.Hope u find this useful!
 
Top