Question: Which line of code is a shorter, more idiomatic version of the displayed snippet?
- `val len = x?.let{x.len} else {-1}`
- `val len = x!!.length ?: -1`
- `val len:Int = (x != null)? x.length : -1`
- `val len = x?.length ?: -1`
Answer: The correct answer of the above question is Option D:`val len = x?.length ?: -1`