- [Instructor] So, we've seen an example of the logical or…used inside of an if statement, a compound if statement.…Why don't we take a look at another example?…This time, we'll use and instead of or.…Let's say we have a method that is designed…to give a letter grade based on a score.…So, typically, what you see is 90 and above is an A,…80 to 89 is a B, and so on.…So, we'll call this one, "Grade Letter."…We'll take an integer as the score,…and what we'll do here is we'll use our if statement.…
So, we'll say if score is greater than 90,…that's all you really need for the A,…will return A.…But for the B, we're going to need a compound statement.…So, we'll say else if score greater than 79…and score less than 90.…If that's the case, then we'll return B.…
For the C, I'll do it slightly differently.…I'll say else if score greater than or equal to 70…and score less than or equal to 80.…And in that case, I'll return a C.…And anything below that, well, let's just give them an F.…You get the idea.…We have a lot of different options here.…
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.