Skip to content

Instantly share code, notes, and snippets.

@matryer
Last active October 22, 2018 23:08
Show Gist options
  • Save matryer/ebbe3c167c86c6051f69 to your computer and use it in GitHub Desktop.
Save matryer/ebbe3c167c86c6051f69 to your computer and use it in GitHub Desktop.
golanguk.com quiz
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)
}
@matryer
Copy link
Author

matryer commented Aug 19, 2015

Inspired (like a lot of things) by Dave Cheney @davecheney https://twitter.com/davecheney/status/508076305003196416

@matryer
Copy link
Author

matryer commented Aug 20, 2015

We'll be picking a winner shortly... so get your answers in :)

@piotrrojek
Copy link

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