Created
April 23, 2022 00:53
-
-
Save annaleighsmith/82b9ba27e77ae564b81e0e6cf7d0efc1 to your computer and use it in GitHub Desktop.
learning go, one of my first little bits of code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
now := time.Now() | |
m := make(map[int]string) | |
_ = now | |
_ = m | |
for i := 0; i < 13; i++ { | |
for i, month := range []string{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"} { | |
i += 1 | |
m[i] = month | |
} | |
} | |
if v, found := m[int(now.Month())]; found { | |
day := strconv.FormatInt(int64(now.Day()), 10) | |
fmt.Printf("Today is %s %s, %d", v, day, now.Year()) | |
} else { | |
fmt.Println("Error") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment