Created
June 28, 2015 08:56
-
-
Save rominirani/5a58c4ee9cf377ce9414 to your computer and use it in GitHub Desktop.
Week 1 Exercise Solutions from Go Course (http://gocourse.slack.com)
This file contains hidden or 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
| Week 1 Exercises from Go Course (http://gocourse.slack.com). | |
| Exercise 1 : | |
| /tmp/sandbox760491916/main.go:6: syntax error: unexpected semicolon or newline before { | |
| Needed to push the start parenthesis to the line contain main(). After that it gave the obvious errors i.e. | |
| - package "os" is imported but not used | |
| - println - cannot refer to unexported name fmt.println | |
| Exercise 2: http://play.golang.org/p/6M5TUvv13O | |
| Exercise 3: http://play.golang.org/p/N9BErUZBQ7 | |
| Exercise 4: http://play.golang.org/p/5OWWHfXz5J | |
| Exercise 5: http://play.golang.org/p/MghgrHkxqj | |
| Exercise 6: Since there is no expression in the switch statement, it defaults to boolean. So the first block that evaluates to true is considered. And in this case it is the case true : fmt.Println("I am true") | |
| Exercise 7: The switch statement expression is an int. However one of the case statements evaluates to a boolean value i.e. i>8, hence it does not compile. | |
| Exercise 8: http://play.golang.org/p/7-GYE9kkLl | |
| Exercise 9a: http://play.golang.org/p/Vzn9l9Jmuk | |
| Exercise 9b: http://play.golang.org/p/JLUdO2YTRo | |
| Exercise 10: http://play.golang.org/p/HXNI5vfGnn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment