go-examples

Get Set Learn Go


Project maintained by sagar-jadhav Hosted on GitHub Pages — Theme by mattgraham

Switch Statement

Example demonstrates working of Switch Statement using the sign to word program. Click here to learn more

func main() {
	var sign string = "="
	switch sign {
	case "=":
		fmt.Println("Equal To")
	case "<":
		fmt.Println("Less Than")
	case ">":
		fmt.Println("Greater Than")
	default:
		fmt.Println("Unknown")
	}
}

Output

Equal To
Try It Out Source Code

Contributors

« Home Page Previous « If Else Statement Next » For Loop