Answers for "switch type golang"

1

switch type golang

var value interface{} = "Hello Grepper"
switch vale.(type){
	case string:
    	fmt.Println("It is a string")
    case int:
    	fmt.Println("It is a int")
    default:
    	fmt.Println("Not sure")
}
Posted by: Guest on June-25-2021

Browse Popular Code Answers by Language