ShinyLemmy
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
ngn@lemy.lol to Programmer Humor@lemmy.mlEnglish · 1 year ago

got him

lemy.lol

message-square
133
fedilink
459

got him

lemy.lol

ngn@lemy.lol to Programmer Humor@lemmy.mlEnglish · 1 year ago
message-square
133
fedilink
  • AVincentInSpace@pawb.social
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    what if I need to nest if lets

    • RustyNova@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      Use a match? Unless it’s for guard clauses, a match is fine enough

      • AVincentInSpace@pawb.social
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        what if i need to if let on the result of another if let

        • RustyNova@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Oh, then you use and_then() or something similar.

          There’s also the possibility to use the guard clauses patern and do let <...> = <...> else {}.

          And finally, you can always split into another function.

          It’s not straight rules. It depends on what makes it more readable for your case.

          • AVincentInSpace@pawb.social
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            what about if on a boolean followed by an if let

Programmer Humor@lemmy.ml

programmerhumor@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: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

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

  • 254 users / day
  • 837 users / week
  • 1.83K users / month
  • 10.4K users / 6 months
  • 1 local subscriber
  • 35.6K subscribers
  • 1.59K Posts
  • 29.9K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.9
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org