for Iterations - 08
- Posted: Nov 21, 2011 at 9:13 AM
- 58,181 Views
- 12 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
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.
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.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
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.
many ways to do it, not sure what way your talking about...
A way that returns the correct result
The point being to try it as it reinforces earlier concepts.
For example:
Will give you something different.
Nice One
Easiest way to get it to display 1 - 10 is to alter the "for" loop.
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.
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:
executeMe();
... 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.
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:
Thanks for the kind words.
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?
O nevermind, Bob, I see you answered my question already below video 9. :)
Remove this comment
Remove this thread
close