Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Bean
- fun imageProcess(repo: MongoRepository) = CommandLineRunner {...}
- // 1 + 2 + 3 is an expression that resolves to an Integer value.
- // Therefore, the return type is Int
- fun intExpression() = 1 + 2 + 3
- // false && true is an expression that resolves to a Boolean value.
- // Therefore, the return type is Boolean
- fun boolExpression() = false && true
- // The when here is a fully exhaustive when expression
- // It can resolve to an Integer or a String.
- // Therefore the return type is the common subtype of both
- // Integer and String which happens to be Any (the root of the Kotlin type heirarchy.
- fun anyExpression(foo: Boolean) = when(foo) {
- true -> 1
- else -> "Hello"
- }
Add Comment
Please, Sign In to add comment