Hacker News new | past | comments | ask | show | jobs | submit login

    int *i, j;
is more than a good enough reason for me. Makes interviews interesting, though: "Why are you repeatedly writing your variables and function parameters incorrectly?"



Interesting example. I'm still a newbie to Go, so would that be written as:

  var i int*
  var j int
My apologies if this seems like a simple question: I haven't played with the language enough to know :)

[EDIT: Sorry, I didn't realize how to format code!]


The asterisk goes before the type for pointers:

    var i *int
Unlike C, values are always initialized in Go.

http://play.golang.org/p/8tAzKyES2I




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: