diff --git a/hello/main.go b/hello/main.go index 8ab932f..f06ecbb 100644 --- a/hello/main.go +++ b/hello/main.go @@ -2,8 +2,24 @@ package main import ( "fmt" + "math/rand" + "time" ) func main() { - fmt.Println("Hello from Go!") + fmt.Println("Evaluate expressions with switch statements") + rand.Seed(time.Now().Unix()) + + var result string + switch dow := rand.Intn(7) + 1; dow { + case 1: + result = "Monday" + fallthrough + case 2: + result = "Tuesday" + //fallthrough // make the control flow less predictable + default: + result = "it's another day" + } + fmt.Println(result) }