Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val accountId = run {
- val accountId = getIt()
- doSomethingWithIt(accountId)
- accountId // returns it from this block
- }
- // vs.
- val accountId = run {
- getIt().also { accountId ->
- doSomethingWithIt(accountId)
- }
- }
- // alternative to #1
- val accountId = run foo@{
- val accountId = getIt()
- doSomethingWithIt(accountId)
- return@foo accountId // returns it from this block named foo
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement