Link#Mastery07 and #Mastery17 #TC1017

This is very similar than the last one, but with the difference is that with elif we can evaluate more than 2 conditions For example: I’m using the same example but the elif is included.
Conditionals are generally a way to check something. The classic “if” example is easy to understand. The syntax helps you understand it a bit. A normal if statement would look like this: if(condition): do something Let’s see an example with food because I’m hungry. My code will basically ask if the food is ready by […]

Here is the video: https://youtu.be/y_x2daj04qo
Thanks for watching !!!
Mastery about how to use elif and else! watch it!
Here’s my video of me explaining masteries#17 and #21. Enjoy.
Use of “switch” as a conditional Here is the link to my video:
On this mastery I’ll show you what and how to use the conditional switch in C++.
Switch is a statement that tests a variable for equality in a list of given conditions. It is somehow a summarized version of IF when you have a lot of conditions.
This flow chart may help you understand better, and this webpage too:

The default syntax of switch goes like this:
switch (expression) case “condition” : outcome [default:statement] //This is used when the variable input isn’t a valid option.
So, for the purpose of this mastery, lets create a program were the user can input his points on masteries so far and tell him if his good or screwed. Do as follows:
- Create our “basic” program.
- Inside the int, declare a char variable with an assigned value.
- Use switch to condition the outcome and tell the user if his good or screwed.
Your program should look something like this:

Now let’s test it:

Let’s just play with another value:

Great! Now you know what and how to use switch conditional.