• @AVincentInSpace
    link
    English
    12 months ago

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

    • @RustyNova@lemmy.world
      link
      fedilink
      12 months 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
        link
        English
        12 months ago

        what about if on a boolean followed by an if let