Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun <T1: Any, T2: Any, R: Any> lets(first: T1?, second: T2?, block: (T1, T2)-> R?): R? {
- return if (first != null && second != null) block(first, second) else null
- }
- fun <T1: Any, T2: Any, T3: Any, R: Any> lets(first: T1?, second: T2?, third: T3?, block: (T1, T2, T3)-> R?): R? {
- return if (first != null && second != null && third != null) block(first, second, third) else null
- }
- fun <T1: Any, T2: Any, T3: Any, T4: Any, R: Any> lets(first: T1?, second: T2?, third: T3?, fourth: T4?, block: (T1, T2, T3, T4)-> R?): R? {
- return if (first != null && second != null && third != null && fourth != null) block(first, second, third, fourth) else null
- }
- lets(userLoginForm.email, userLoginForm.password) { email, password ->
- // email and password guaranteed to not be null
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement