!! in kotlin
//The not-null assertion operator
val l = b!!.length
!! in kotlin
//The not-null assertion operator
val l = b!!.length
kotlin elvis operator
In Kotlin, if statements are expressions. So the following code is equivalent:
if (a) b else c
The distinction between expression and statement is important here. In Java/C#/JavaScript, if forms a statement, meaning that it does not resolve to a value. More concretely, you can't assign it to a variable.
// Valid Kotlin, but invalid Java/C#/JavaScript
var v = if (a) b else c
If you're coming from a language where if is a statement, this might seem unnatural but that feeling should soon subside.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us