programming For loop until a specific value (C#)
Go to solution
Solved by RhinoMcD,
I haven't really lived in the C# world all that much, but i'm gonna take a guess that your first two only print '0'
EDIT: @Sauron clarified:
QuoteThe first two will actually never even run because it sets i to 10, then checks if i is equal to 0, notices it is not (we just set it to 10), and does not enter the loop.
You're probably looking for this:
for (int i = 10; i >= 0; i--)
which will take all values of i that are greater than or equal to 0
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now