Initial commit
This commit is contained in:
26
12-switch/07-short-switch/main.go
Normal file
26
12-switch/07-short-switch/main.go
Normal file
@ -0,0 +1,26 @@
|
||||
// For more tutorials: https://blog.learngoprogramming.com
|
||||
//
|
||||
// Copyright © 2018 Inanc Gumus
|
||||
// Learn Go Programming Course
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// i := 10
|
||||
|
||||
// true is in a comment now
|
||||
// you can delete that part if you want
|
||||
// it's by default true anyway.
|
||||
switch i := 10; /* true */ {
|
||||
case i > 0:
|
||||
fmt.Println("positive")
|
||||
case i < 0:
|
||||
fmt.Println("negative")
|
||||
default:
|
||||
fmt.Println("zero")
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user