MCQs > IT & Programming > Swift > extension Int { subscript(var myInt: Int) -> Int { var no1 = 1 while myInt > 0 { no1 *= 10 --myInt } return (self / no1) % 10 } } print(12[0]) What is the output?

Swift MCQs

extension Int {

   subscript(var myInt: Int) -> Int {

  var no1 = 1

  while myInt > 0 {

     no1 *= 10

     --myInt

  }

  return (self / no1) % 10

   }

}

print(12[0])

What is the output?

Answer

Correct Answer:

2

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Swift Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Swift Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it