From the course: Transition from C# to Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Conditional statements

Conditional statements

From the course: Transition from C# to Python

Start my 1-month free trial

Conditional statements

- [Instructor] The C# language gives us a few different ways to perform conditional statement operations. So here in my Conditionals folder, going to open up ConditionalsCS and then the program, that CS file. So first there's the if statement and then there's the switch statement, and then of course there's the compact conditional form of the ternary assignment operator. So let's go ahead and just run this example as it is. And we can see here that we've got x, y, and z and they're all integers, 10, 20 and 30. So the first if statement says if x is less than y, then we'll print result #1, so that's what should happen. And then we're going to switch on x and in the case of 10 and 20, again, we print result #1. And then for the last one if z is less than y we're going to print result #4 versus result #5, and let's see, z is not less than y, so it looks like we should get result #5 on that one. So let's go ahead to the terminal…

Contents