@[email protected] to Programmer [email protected]English • 7 months agogot himlemy.lolimagemessage-square134fedilinkarrow-up1475arrow-down141
arrow-up1434arrow-down1imagegot himlemy.lol@[email protected] to Programmer [email protected]English • 7 months agomessage-square134fedilink
minus-square@RustyNovalink4•7 months agoUse a match? Unless it’s for guard clauses, a match is fine enough
minus-square@[email protected]linkfedilinkEnglish1•7 months agowhat if i need to if let on the result of another if let
minus-square@RustyNovalink1•7 months agoOh, 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.
minus-square@[email protected]linkfedilinkEnglish1•6 months agowhat about if on a boolean followed by an if let
what if I need to nest
if let
sUse a
match
? Unless it’s for guard clauses, a match is fine enoughwhat if i need to
if let
on the result of anotherif let
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.
what about
if
on a boolean followed by anif let