12
Jan

Learn How To Program In C# Part 8 – For Loop


Hey, everybody. Today we’ll be talking about the for loop. Whenever we’re using a for loop, that means
that we know the amount of times it’s going to be executing. for loop is intended to execute
a set number of times, whereas with the while loop, most of the times we have no idea when
it’s going to stop. Obviously, we have a Boolean expression. When it evaluates to false, the while loop
stops running. However, we don’t know how many times it
will run. for loops usually are used to iterate through a list because we know the size of
the list. Let’s write out a simple for loop so we
see how it looks like. Create a console application. Name it as LoopingFor. This is the Main method where the execution
of our program begins, as you already know. If you type for and press Tab, it’ll generate
the loop for you. for (int i=0; i

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

4 Comments

  • Sebastian Smit says:

    you're a better teacher than the programming teacher at my university. I've learned more from these 8 classes so far than I ever did at his classes. Thanks for taking the effort to make these videos 🙂

  • Cody McKinney says:

    how do you do that when you are essentially running the app by just scrolling down with the aarow tab. and its printing what you are scrolling over.

  • theycallmetamale says:

    So what does the "{0}" mean on the " The i is {0}", i); statement? Also do you have videos on flowcharts and IOP charts? I am a beginner like I said and Im looking for all the help I can get. Your videos have seriously helped me. I have also shared your videos with my whole class. Thank you! P.s. If the questions have been asked before let me know. Thanks 🙂

  • Leonux says:

    you are an amazing teacher! thank you so much

Leave a Reply

Your email address will not be published. Required fields are marked *