- [Instructor] There are two more…key words in C# that I want to show you…with respect to loops and those are break and continue.…These key words allow you to modify…how a loop executes, so let me show you how this works.…I'll create a method which I'll code…as public, string for the return type,…and let's just call it break and continue.…For this I will start off with…a string builder, which I'll call SB.…
Set it equal to a new string builder.…I'm going to iterate over a list of words…and then I'm going to conditionally…add those words into the string builder…but I'm not going to do it quite…the way you might be thinking.…Let's do a list of words as var words…equals new list of type string and…I'll go ahead and use the collection initializer…to make the list that we did earlier when…we started introducing lists and…we'll do bread, milk, eggs,…cheese, and apples.…
To iterate over this we'll use a for each loop.…I'll say for each, var word in words.…I'll give myself a little bit of room…and then down at the bottom I'll say sb.appendline…
AuthorBruce Van Horn
- Writing unit tests in C#
- Working with simple and multidimensional arrays
- Managing ordered and unordered data with lists
- Evaluating conditions with if-else statements
- Using OR, AND, and NOT operators
- Building loops
- Debugging and handling exceptions
- Creating the final build of your C# project
Skill Level Beginner
C# Object-Oriented Programming Tips and Trickswith Jesse Freeman58m 39s Intermediate
1. Unit Testing and Test-Driven Development
2. Arrays and Collections
3. Flow Control
4. Exception Handling
5. Getting to Production
Next steps1m 57s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.