Hello everyone, just a quick question, what's the ...
# arrow
i
Hello everyone, just a quick question, what's the proper way of immediately leaving a Option.monad().binding block or any other type? Is there a better way than just None.bind() (using Option, for example) ?
s
What about an
if
statement, when it's false it doesn't execute the rest of your code?
i
I need to return something from the function, and it's basically entirely wrapped in the binding block 😞
s
I guess
None.bind()
would work, but it looks so hacky…. What about
val ret = (if (something) { my actual code ... } else { None }).bind()
? (still look hacky-ish to me 🙂 )
i
yeah, exactly 😄, guess I'll have to choose the less hacky version, thx
r
@Icaro Temponi do you have a small reduced example? You should not have to ever bind on None explicitly. We can rewrite it if it isn't optimal. Perhaps you don't need binding there at all
arrow 1