Answers for "golang select case"

Go
1

golang switch

func main() {
	i := 2
    switch i {
    case 1:
        fmt.Println("one")
    case 2:
        fmt.Println("two")
    case 3:
        fmt.Println("three")
    }
}
Posted by: Guest on May-30-2022
0

Switch in golang

switch day {
  case "sunday":
    // cases don't "fall through" by default!
    fallthrough

  case "saturday":
    rest()

  default:
    work()
}
Posted by: Guest on December-29-2021
0

case in golang

i := 2
    fmt.Print("Write ", i, " as ")
    switch i {
    case 1:
        fmt.Println("one")
    case 2:
        fmt.Println("two")
    case 3:
        fmt.Println("three")
    }
Posted by: Guest on August-26-2021

Browse Popular Code Answers by Language