Hi Trig, I'm new to the list and I'm a Go newbie, but
> On 12. Feb, 2021, at 01:09, Trig <edb1...@gmail.com> wrote: > > So, in Go... you can either define imports, constants, types, variables one > at a time... or you can group them using brackets. Why was it decided not to > be able to do that with functions? Just curious. > > func ( > main() { > fmt.Println(helloWorld()) > } > > helloWorld() string { > return "hello, world..." > } > ) I guess it's because: var ( a int, b string, ... ) is just a syntactical grouping, which var also be written as: var a int var b string ... while func ( func x() { ... } func y() { ... } ) would affect scope. In the above x() and y() would be local functions to an unnamed function. Defining the scope is what packages are for. I'd really love to see local functions, though, not for real scope usage but for clarity of coding. Also, grouping functions inside func (...) wouldn't make sense because that'd only mean that you'd basically indent almost all of your code unnecessarily by one tab, or whatever you use. Cheers, Paul -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8E1718DD-1CFF-4216-86ED-C918FB2D7AF1%40gmail.com.