Last active
October 22, 2018 23:08
-
-
Save matryer/ebbe3c167c86c6051f69 to your computer and use it in GitHub Desktop.
golanguk.com quiz
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
package main | |
import ( | |
"fmt" | |
) | |
/* | |
Question: | |
What will be printed by this program? | |
Hint: | |
It'll print the type, then the value | |
Correct answers will go into a slice and we'll rand.Int someone | |
to win a copy of Go Programming Blueprints plus £25 off registration | |
to Friday's Golang UK Conference http://www.golanguk.com | |
*/ | |
func main() { | |
a := [...]string{ | |
"g", | |
"o", | |
7:"k", | |
6:"u", | |
4:"n", | |
5:"g", | |
3:"a", | |
2:"l", | |
} | |
// print the type and value | |
fmt.Printf("%T %[1]v",a) | |
} |
Not interested in the ticket, but I'm guessing that [8]string golanguk
? :)
edit: yep, I was close! Had to go through the documentation earlier though... https://golang.org/pkg/fmt/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We'll be picking a winner shortly... so get your answers in :)