- [Instructor] So we've seen two different ways…to do this sort of if, else logic structure,…but I alluded, at one point,…that there was a better way to do this.…And you might've thought that I was talking…about the switch statement here on line 13,…but actually, I wasn't.…The problem with this code is it's rather long,…considering we're really only trying…to get down to two possible answers.…So there's actually an easier and faster way to do this,…without writing quite so many lines of code.…So let's write this a different way,…let's write public string, primary…or secondary, and this time we're going to use compound logic.…
So I'll just call this one primary or secondary compound,…so that I can tell the difference.…We'll take our color string as usual,…and what I'm going to do this time…is I'm going to use an if statement,…like I did the first time, but I'm going…to do this with a compound statement.…Which means, I can detect more than one condition…in a single statement.…So I'll say if color dot to lower…equals red, or, and I say or…
Author
Released
1/19/2018- 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
Duration
Views
Related Courses
-
C#: Delegates, Events and Lambdas
with Joe Marini1h 9m Intermediate -
C# 7 First Look
with Reynald Adolphe1h 9m Beginner -
C# Object-Oriented Programming Tips and Tricks
with Jesse Freeman58m 39s Intermediate -
Learning C# Algorithms
with Reynald Adolphe1h 28m Beginner
-
Introduction
-
Welcome1m 17s
-
What you should know1m 48s
-
-
1. Unit Testing and Test-Driven Development
-
What is unit testing?1m 25s
-
Writing a unit test3m 53s
-
Running tests1m 57s
-
Setting up tab groups1m 16s
-
-
2. Arrays and Collections
-
Simple arrays4m 36s
-
Resizing arrays4m 4s
-
Working with simple arrays3m 53s
-
Working with lists2m 53s
-
Introduction to LINQ4m 25s
-
-
3. Flow Control
-
If-else, if-else statements2m 34s
-
Switch statements3m 40s
-
Logical NOT1m 26s
-
For loop4m 22s
-
Testing the assembly3m 56s
-
The foreach loop3m 38s
-
Do and do-while loops3m 23s
-
4. Exception Handling
-
Adding a console project4m 7s
-
Cleaning up with finally2m 3s
-
-
5. Getting to Production
-
Working with NuGet packages4m 18s
-
Logging with NLog6m 6s
-
Final build3m 7s
-
-
Conclusion
-
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.
CancelTake 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.
Share this video
Embed this video
Video: Compound logic with logical OR