Answers for "boolean switch case golang"

Go
1

golang switch

package main 
    
    my_number := 2
    fmt.Print("Write ", my_number, " as ")
    
    switch my_number {
      case 1:
          fmt.Println("one")
      case 2:
          fmt.Println("two")
      case 3:
          fmt.Println("three")
      default :
          // default case 
    }
Posted by: Guest on April-20-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

Browse Popular Code Answers by Language