Short question about Return

When I write just return to get “false”, don’t I?

Indeed it is a short question, so short that I’m not certain I know exactly what you mean!

I think you’re asking about a function like this:

func getFalse (b bool) { return }

Which will return false, but for a function like this, you get zero:

func getZero() (i int) { return }

You’ll always get the zero value, just like with other uninitialized variables.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.