daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Oct 18th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Bean
  2. fun imageProcess(repo: MongoRepository) = CommandLineRunner {...}
  3.    
  4. // 1 + 2 + 3 is an expression that resolves to an Integer value.
  5. // Therefore, the return type is Int
  6. fun intExpression() = 1 + 2 + 3
  7.  
  8. // false && true is an expression that resolves to a Boolean value.
  9. // Therefore, the return type is Boolean
  10. fun boolExpression() = false && true
  11.  
  12. // The when here is a fully exhaustive when expression
  13. // It can resolve to an Integer or a String.
  14. // Therefore the return type is the common subtype of both
  15. // Integer and String which happens to be Any (the root of the Kotlin type heirarchy.
  16. fun anyExpression(foo: Boolean) = when(foo) {
  17.     true -> 1
  18.     else -> "Hello"
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top