Quick actions

cmd+k|ctrl+k

Navigation

Languages

Essential Go / if, switch, goto

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-03-26T10:01:28Z

Updated

2019-03-26T10:01:28Z

package main

import "fmt"

func main() {
	stmt := "if"
	switch stmt {
	case "if", "for":
		fmt.Printf("stmt ('%s') is either 'if' or 'for'\n", stmt)
	case "else":
		fmt.Printf("stmt is 'else'\n")
	default:
		fmt.Printf("stmt is '%s'\n", stmt)
	}
}
INFO