🥥Flujo If, For, While, Switch
Aqui en está sección veremos algunos condicionales, ciclos y bucles dentro del lenguaje de programación Golang.
Flujo IF ->
//FLUJO IF
edad := 18
if edad >= 18 && edad <= 55 {
fmt.Println("Es un adult@")
}else if edad < 18 {
fmt.Println("es un niñ@")
}else {
fmt.Println("Es un ancian@")
}Ciclo FOR →
//FLUJO FOR
for i := 0; i <= 10; i++ {
fmt.Println("FOR:", i)
}
nombre := "Felipe"
for i := 0; i < 6; i++ {
fmt.Println(i, string(nombre[i]))
}En GO no existe el WHILE (su palabra) →
Sentencia BREAK →
Sentencia Continue →
Sentencia RANGE →
¿Cómo funciona Range?
Sentencia Switch →
Juego de adivinanzas con sentencia Switch →
Last updated
