Reputation: 394
I have recently decided to switch from Java to Kotlin for Android Development. I don't know what to Google, so I'm asking here.
If we want to get the opposite of a boolean, we put a ! before it. Eg: I want the inside code to run only if the contains() returns false. How to do that?
Example, we do this in Java:
if (!string_text.contains(" "))
How do I write this in Kotlin?
Upvotes: 0
Views: 1947
Reputation: 1452
!
is the boolean not operator, same as Java.
Check https://kotlinlang.org/docs/reference/keyword-reference.html#operators-and-special-symbols
Upvotes: 4