Tag Archives: #Mastery17

MASTERY 17 Use of "elif" with a conditional

USO DE “elif” CON UNA CONDICIONAL

El comando “elif” es muy similar al comando “if” y también al comando” else”. La diferencia es que con “elif” debes de poner la condición como en “if”, pero diferente. Hay que considerar que “else” se utiliza en caso de que uno más variables no cumplen con las condiciones anteriores y esas condiciones tienen “if” y “elif” y no necesita que se le teclee una condición en específico, lo que diferencia con “elif”. La estructura es la misma con los demás condiciones. Aquí les tengo un ejemplo:
MASTERY 17 Use of "elif" with a conditional
Aquí tenemos unas condiciones que toma una calificación. Dependiendo de cuánto saques, estarás aprobado, reprobado o expulsado. “if” utiliza la condición quienes sacan 70 o más aprueban el curso. Si “elif” no estuviera ahí y “else” tomaría su lugar, el programa tomaría la condición quienes sacan menor de 70 reprueban el curso. Aquí tenemos “elif” y su condición quienes sacan menor de 70, pero sacan 40 o más reprueban el curso, pero todavía tienen otra oportunidad para pasar. Ahora con “else” se utiliza lo contrario de las condiciones anteriores: quienes sacan menor de 40 no solo reprueban el curso, también son expulsados de la institución. Aquí mostraré el ejemplo en la terminal:

MASTERY 17 Use of "elif" with a conditional

Hello there! here is my Mastery17

Check my new video where you can learn about python!

Use of elif on Python!! 

Here is the link of my Mastery17: https://youtu.be/F6kbfPiEM6Y

 

Use of switch as a conditional

Hello every body this is

In this post I let you a link to watch my short viedo about the use of “switch” as a conditional 

an the differences between this and use “if” and “else”

Enjoy it :

 

https://www.youtube.com/watch?v=HWmJuB4xIZQ

Buen dia #TC1017 Aqui esta el link del video de la #Mastery17 https://youtu.be/k194S4i8S3A Saludos

Buen dia
Aqui esta el link del video de la
https://youtu.be/k194S4i8S3A
Saludos

#TC1017 # Mastery17 Use of “switch” as a conditional

Mastery17 – Conditional elif

the elif conditional es a combination of the else and if conditionals, it needs a to fulfill a conition like the if conditional but it will be ignored if the condition above is fulfilled like an else conditional.

if we had this conditionals:

if x != 0:

   print(“it’s not a 0”)

if x > 0:

   print(“more than 0”)

if x < 100:

   print(“less than 100”)

and we used 50 as x, the program will print everything since 50 meets each condition but if we change any of the if conditionals after the first to elif the program would ignore them since the first will be true. elif is to stick two statements as one.

#MASTERY17

HI !! Here is a video of how to use switch case in c++

https://www.youtube.com/watch?v=B631W55VPGI&feature=youtu.be

Use of “switch” as a conditional

#Mastery17

This mastery is useful to learn a different conditional, I explained “else”, “if” and “else if” conditionals before, but in this post I am going to explain “SWITCH” conditional. This conditional works as “if” conditional, but I think that it is easier to understand, because the structure is simpler.

I did a program that shows how this conditional is used, here you can see a picture about that:

Also I did a pp to explain this conditional, this is the link:

https://drive.google.com/file/d/0B-NM4ghaDXBvc0NvdnkxVk9GdFk/view?usp=sharing

And you can find my c++ code here:

https://drive.google.com/file/d/0B-NM4ghaDXBvd0gtVGxYWnRiSVE/view?usp=sharing

Finally this links were useful for me and you could find them interesting and useful to learn more about “switch”:

https://adolfredobelizario.wordpress.com/2012/06/19/tutorial-5-lenguaje-c/

http://aprende-a-programar-ya.blogspot.mx/2011/08/estructura-condicional-multiple.html

 

SWITCH

 

DIEGO PLASCENCIA SANABRIA      A01229988

El swich case se usa cuando se necesita evaluar muchas condiciones a la vez.

La instruccion switch es de desicion multiple, donde el compilador busca en una lista de constantes y cuando encuentra el valor de igualdad de constante y variable, ejecuta las instrucciones asociadas.

Las constantes SOLO pueden ser de tipo INT o CHAR.

SIEMPRE despues de cada instruccion, se escribe un // break;

Aqui hay un ejemplo de como se hace:

switch(var int o char)

{

case const1: instrucción(es);

break;

case const2: instrucción(es);

break;

case const3: instrucción(es);

break; ………………

default: instrucción(es);

};

GRACIAS POR LEERLO, ESPERO HABER AYUDADO, PARA MAS INFORMACION VISITA ESTE LINK:

https://www.programacionfacil.com/cpp/instruccion_switch