Guest User

Untitled

a guest
Oct 18th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment