In Java we do use ! in case we want to say NOT. But what should I use in Kotlin if I follow some range condition.
if( item in 5..10)
So here I want to say if item NOT in 5..10 ?? what is the proper construction?
>Solution :
You can use !in operator:
if (item !in 5..10)
See documentation for a full list of operators:
- https://kotlinlang.org/docs/operator-overloading.html#in-operator
- https://kotlinlang.org/docs/keyword-reference.html#hard-keywords