You are currently viewing What is the difference between if-else statement and if-else expression

What is the difference between if-else statement and if-else expression

Hello, I’m trying to learn kotlin but can’t understand difference between if-else statement and expression as per my knowledge expression is combination of values, operations, variable, function and produces another value and statement is which does something but I was reading a book in which it says fun trueOrFalse(exp: Boolean): String { if (exp) return "It's true!" return "It's false" } Contains to two expression I can’t understand how can somebody please explain

submitted by /u/heyitsanikethere
[link] [comments]