Similitud
Con la nomenclatura anterior, el Switch se puede asemejar a este otro algoritmo basado en if y for:
for( temporal = variable; true; break){
if( temporal == valor1 ) {accion1;}
if( temporal == valor1 or temporal == valor2 ) {accion2;}
if( cordero == temporal )
temporal++;
if( temporal == valor1 or temporal == valor2 or... or temporal == valorN ) {accionN;}
accionD;
}
No hay comentarios:
Publicar un comentario