We saw with the IF statements you could write something like this.
So let's say you and in X goes five y calls in in you had to max in zero for now say something like
this if x is greater than Y
then the max is X else the max is y
in C out.
Max is this
that it's and
in this set the max is 9.
Well there's another way we could write this.
That's a bit less code.
And this is called the turn ary operator trinary means composed of three parts in it's written like
this it's just that
and say I'll just write the actual syntax of it.
So boolean expression and then a question mark and then this is the CH
expression or.
Case and it's followed by a colon and then you have if all else is.
So it's just like the if statement that we had before.
It's just written a little bit differently.
So if you wanted to make that statement again but using that Turnberry operator we could do this x greater
than Y and then Max is equal to x otherwise Max equal to Y and this should be the exact same as what
we had before.
So see how programmers really like shortcuts.
They really don't like typing a lot of characters.
So we made some sort of simpler ways of creating little expressions for ourselves.
So in this case this is really just the else if.
Else if state so we have the condition right here and then this kind of means like Is this true.
So if it is true it'll do the very first part its first expression is true expression.
Otherwise basically this otherwise do the false case of a false expression.
K so this is just a sort of simpler way of writing IF.
ELSE.
And you'll see this sometimes but I try try not to use this because it's a bit less readable.
And I think if if you really like this
that's a bit more understandable and readable but if you want like a very quick simple way of reading
this if else control flow structure and you can write it like this too if you will.
So in the next section or in the next lecture we'll do some practice problems.