Lemmy Coupou.fr
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
khoi@slrpnk.net to Go programming language discussion@lemmy.ml · 2 years ago

Should I use naked return? If not, why? If yes, when?

message-square
message-square
2
link
fedilink
7
message-square

Should I use naked return? If not, why? If yes, when?

khoi@slrpnk.net to Go programming language discussion@lemmy.ml · 2 years ago
message-square
2
link
fedilink
alert-triangle
You must log in or # to comment.
  • squirmy_wormy@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    2 years ago

    This says when it’s ok to use them and why it should be limited

    https://go.dev/tour/basics/7

    Personally, I don’t like them. Makes things awkward to read imo

    • ck_@discuss.tchncs.de
      link
      fedilink
      arrow-up
      3
      ·
      2 years ago

      Yeah, I tend to agree, naked returns are hard to read and they don’t really add much in terms of value.

      I avoid them in my code.

Go programming language discussion@lemmy.ml

golang@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !golang@lemmy.ml
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 3 users / day
  • 6 users / week
  • 4 users / month
  • 22 users / 6 months
  • 1 local subscriber
  • 1.55K subscribers
  • 101 Posts
  • 53 Comments
  • Modlog
  • mods:
  • gregf@lemmy.ml
  • ReK2@lemmy.ml
  • whou@lemmy.ml
  • BE: 0.19.12
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org