Dnia Wed, 19 Mar 2025 23:21:56 -0400 Mike Schinkel <m...@newclarity.net> napisaĆ/a:
> The pain point I was experiencing is having to write (and later having to > read) this tortured control structure in many different places: > switch c { > case ' ', '\t', '\n': > return Token > } You can write this in a single line, if you wish. While you are not required to write semicolons in appropriate places, you can. You can write Go in a single line, to let feel it "smaller in scope": " switch c { case ' ', '\t', '\n': return Token }; " will compile happily. Try: echo "package main; func main() { x := func (c rune) int { switch c { case ' ', '\t', '\n': return 1 }; return 0 }; println(x(' ')) }" > foo.go ; go run foo.go Hope this helps, -- Wojciech S. Czarnecki OHIR-RIPE -- 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 visit https://groups.google.com/d/msgid/golang-nuts/20250320154325.713df5a7%40xmint.