Home
Blog
Favorite Go Language Feature
Updated
Dot Net Perls

Favorite Go Language Feature

The Go programming language has many uncommon features, like fast compile-times, multithreaded routines, and types that are safe to use on threads. But one of the first a new developer will encounter is multiple return values.

It makes sense to me that a method can return multiple values. I mean, it is 2025—we should not be limited to returning one value at a time. Other languages can return tuples, Options, Results, arrays or maps but Go has native support for multiple values.

There are some implications to Go's native multiple value support:

You can assign to the return values with names.
Many functions return an "ok" value as the second value, like the map, which is easy to understand.
You don't need to include any namespaces or modules just for a return type.

It's probably one of the earliest features a new Go developer will encounter, and it is so deeply-built into the language that multiple return values are one of the best features of Go.

Dot Net Perls is a collection of pages with code examples, which are updated to stay current. Programming is an art, and it can be learned from examples.
Donate to this site to help offset the costs of running the server. Sites like this will cease to exist if there is no financial support for them.
Sam Allen is passionate about computer languages, and he maintains 100% of the material available on this website. He hopes it makes the world a nicer place.
No updates found for this page.
Home
Changes
© 2007-2025 Sam Allen