Loops
A for loop repeats code a set number of times: for (int i = 1; i <= 5; i++) starts at 1, runs while i <= 5, and adds 1 each time.
A while loop repeats as long as a condition stays true. Make sure something inside it changes, or it never stops.
i++ adds 1 to i, and i += 2 adds 2, which is handy for counting in steps.
Example (inside Main)
for (int i = 3; i >= 1; i--)
{
Console.WriteLine(i);
}
Console.WriteLine("Lift off!");
Output
3 2 1 Lift off!
i-- counts down by one, the opposite of i++.
Your tasks
0 of 3 done- Write a for loop that counts from 1 to 10
- Print the loop variable with Console.WriteLine
- Print the 5 times table with a second loop
Tutor
The tutor guides you toward the answer instead of handing it over. It uses your own Claude usage.
Quick check
How many times does for (int i = 0; i < 3; i++) run?
No problems found. Unclosed tags, missing semicolons and errors show up here in plain words.