# Tag Archives: #Mastery16

## If and Else

Aqui esta un nuevo tutorial para poder saber como utilizar un if y tambien un else como condicionales.

1017

15

16

## Mastery16

Use of “else” with a conditional

16 1014

## #Mastery16 Courses with Ken

Enjoy the video

http://youtu.be/XNiKxXooXeY

## #Mastery16

16 1017

This is the second time I do this Mastery16 in order to make  two points out of it!

I will explain you how to use an else conditional..

But first, why use an else conditional and how does it work. Well the else conditonal  is use with the if conditional which i already explained earlier. The else conditional is when the if conditional is false, lets say, if you ask the user something with if and is true  it wil return you whatever you put there, but if it isn´t true then it will not print anyting unless you have another if or somekind of cout outside the if, but is more bother to do that.

What the else conditonal does is  to return you something if the if conditional isn´t true.

The syntax for using else is:

“else

{

}”

As you can se is pretty easy to do so sure it will be no problem using it.

But let see how will you use with an if when the variable num is somehting the user give us and we ask for a number between 1 and 10:

“if (num 10)

{

cout

} else {

cout

}”

What does it say with words “If you put a number less than 1 or higher than 10 then it prints “Your number is invalid”, or if your numbers is higher or equal to 1 and less or equal to 10 then it prints “Great your number is between 1 and 10”.

So here you can se how easy is to use the else conditional and that it is very very useful when your are doing enourmous codes and your tired of writing or just because is not compplicated.

Hope you learn from this!

## Mastery 16

Just did the mastery 16, quite easy to understand, you just need a little bit of logic.

1014 16

## Mastery 16

16 1017

En esta sentencia no se plantea directamente una condición, es mas bien, una respuesta a la condición que se formulo dentro de la sentencia “if”. Si la condición de “if” no se cumplió, entonces se ejecuta el bloque de código que contenga la sentencia “else”.
Además, no puedo haber una sentencia “else” sin su respectiva sentencia “if”

la sentencia else funciona despues de ingresar una función if. despues de que el valor de if de erroneo, corre directamente la función else con el codigo que se este utilizando.