Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Content Obsolete

This content is no longer current. We recommend you try the following url for more up to date content: http://channel9.msdn.com/Series/C-Fundamentals-for-Absolute-Beginners

for Iterations - 08

10 minutes, 20 seconds


Right click “Save as…”

Iterations allow our applications to loop through a block of code until a condition is satisfied. We'll cover several different types of iteration statements throughout this series, starting with the for iteration statement. This lesson demonstrates how to utilize "code snippets" to help remind you of the syntax for this complex statement, and shows debugging in action via the values of loops displayed in the Visual Studio IDE.

Download the source code for Iterations


Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • Nice

  • Great video series Bob.

    Here's a nice homework challenge for this lesson that ties back to the lessons on data types.

    Challenge: Modify Bob's code so that the numbers displayed are 1-10 instead of 0-9. Don't forget to modify when 7 is found. I found several ways to do it wrong before I figured out a correct method.


  • TeraTera

    many ways to do it, not sure what way your talking about...

  • many ways to do it, not sure what way your talking about...

    A way that returns the correct result Wink The point being to try it as it reinforces earlier concepts.

    For example:


    Will give you something different. 

  • Thennarasanthens #(: Known is a Drop, UnKnown is an Ocean :)#

    Nice One Smiley

  • ErikErik

    Easiest way to get it to display 1 - 10 is to alter the "for" loop.

  • SkyeblueSkyeblue

    What i wish was explained is why are parenthesis used by themselves vs when do parenthesis rest inside another pair of parenthesis? i.e... console.writeline(message); vs console.writeline (i.toString()); don't think I heard this explained.

  • @Skyeblue: First of all, KUDOS for being an "active learner" ... for having questions about the content and not just accepting the order I'm presenting the content.  I am an active learner too ... I have to "control" the learning process by asking questions.  So, again, you're doing it right.  Smiley

    Specifically to your question ... You might want to re-watch Lesson 7 on operators wherein I say that the parenthesis operator plays several roles, but when butted right up next to an identifier (like a method name) means that it is used as the method invocation operator ... so:


    ... will EXECUTE the method.  

    In the examples you used:

    console.writeline()  <--- here we're invoking the writeline method of the console object

    i.ToString() <--- here we're invoking the ToString method of integer objects

    What the heck does all that mean?  In Lessons 10 and 15 we'll talk about methods more.  So, we're getting there!!!  Just hang in there.  Smiley

  • TylerTyler

    You say thank you at the end of each video, but I should be thanking you!
    So far so good! I'm still rusty on a few things, but with practice, I'm sure I'll get better!

  • @Tyler: Smiley  Thanks for the kind words.

  • lyndalynda

    Dear Bob,

    First off: your lessons are great! Thank you for that.
    Secondly I still don't understand why there is an ToString in Console.WriteLine(i.ToString) and with the myX example it is not there.
    I recreated your examples and all seems to work either with or without ToString. I am not sure if this is the same question SkyeBlue asked, but I don't think so. Maybe the answer to my question become clear as well later on?

  • lyndalynda

    O nevermind, Bob, I see you answered my question already below video 9. :)

Remove this comment

Remove this thread


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.