I am just starting Go and tried implementing switch statement. As far as I know this statement in other languages require "break;" but not in Go. Somehow my code jumps directly into default block. By the time I am writing this question, it is 23/04/2022, Saturday.
P.S. I would be grateful if any of you could suggest me any platforms, where I can take Go courses for free.
This is my code:
package main import ( "fmt" "time" ) func main() { fmt.Println("when is Sunday?") today := time.Now().Weekday() switch time.Sunday { case today + 0: fmt.Println("Today.") case today + 1: fmt.Println("Tommorow.") case today + 2: fmt.Println("In 2 days.") default: fmt.Println("Too far away.") } }