FAQ

On Wednesday, 31 October 2012 10:07:42 UTC+1, Philipp Schumann wrote:
See this for an example of what I mean:

http://play.golang.org/p/ivgLHovmUr

Obviously gives compiler error:

prog.go:14: assignment count mismatch: 3 = 1

I liked this kind of style in Python, given that mulltiple assignments per
line are possible in Go (ie. x, y, z = 1, 2, 3), is there a syntactic
technique for the above?

As minux hinted at, what you're basically asking for is implicit type
conversion, which Go simply does not do. Your function returns a slice,
which can be of variable size, doesn't it make more sense if the program
reflects this?

http://play.golang.org/p/CrvH2cfkPV

--

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 22 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 31, '12 at 9:15a
activeNov 2, '12 at 7:51a
posts22
users11
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase