[kotlin] Kotlin Ternary Conditional Operator

example: var energy: Int = data?.get(position)?.energy?.toInt() ?: 0

In kotlin if you are using ?: it will work like if the statement will return null then ?: 0 it will take 0 or whatever you have write this side.