-
-
Save ironsmile/b6c2d15f5fa4b334a408 to your computer and use it in GitHub Desktop.
Golang's strange len operator
This file contains 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 | |
func main() { | |
var buff = make([]byte, 1024) | |
var out string | |
out = out + string(buff) | |
println(out) // nothing, as expected | |
println(len(out)) // 1024 !? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment