Question: The code below shows a typical way to show both index and value in many languages, including Kotlin. Which line of code shows a way to get both index and value more idiomatically?

  1. `for( (ndx, value) in (1..20).withIndex() ){`
  2. `for( (ndx, value) in (1..20).pair() ){`
  3. `for( Pair(ndx, value) in 1..20 ){`
  4. `for( (ndx, value) in *(1..20) ){`

Answer: The correct answer of the above question is Option A:`for( (ndx, value) in (1..20).withIndex() ){`