I'll come back in this lecture I'm going to show you how you can use boolean expressions in a suchit
that's not I'm going to create a simple code.
Well tell us about whether a number is positive negative or zero.
This type of sui state and again like this is so we just condition this time instead of a variable.
I'm going to type a boolean value through ok.
At I case clouds like this.
Let's assume that it is an integer reachable declared somewhere.
If it's positive than the bool expression be true right then it will be equal to this we just condition
because it's true as well.
So it will be executed
writes OK on you.
Remember this the type so if the case conditions should be identical to the type of the each condition
right.
So since a type of serious condition is bool so I can type a case condition as a bold expression as
you know Eble expression yields Zabiullah value.
I can type such a bold expression because the beaches condition is all bull go guess is the type of
the condition expression from this value just true not both the type of the sweetness condition and
the k's condition.
Har bool.
You can type in Boola expression as a case condition OK let's add one more case clause here.
Look at another case clause to detect and to rable All right.
Now let's add another case or the zero to do that.
I can add a default clause instead of a case clause.
It's because there are no more options left.
A number can be positive or negative but can't be boffed right so it should be zero and the default
clause is great for detecting that OK.
This switch statement works because go wrong a switch statements from top to bottom.
It first tries the first case condition at the top then it tries the next one and the next and so on.
And if none of the case clauses match then it goes and executes the default class.
Of course if there is one by the way one more thing is left to do Ingo.
So which is condition by default is true.
So you don't need to type 2 as a condition.
Let's remove the true value here from the condition like this.
Better now it's more concise.
The same rules still apply.
Since the switches condition is a bull value so all the case conditions also should be bool expressions.
All right now this statement is ready.
Let's take a look at it inside the code editor
OK.
Here it is this change the comments to printed on colors instead.
I'm fast forwarding.
All right OK ready let's run it now.
It says positive because the IRA airball is tyin it has a positive number of Wisley OK.
Now let's make its negative
and run it again.
No it prints negative unless the let's make it 0 and 1.
This time it prints 0.
It works good ok you learnt how boolean expressions work with switch statements.
Seen the next picture of a.