Loading practice questions
What is the with scope function used for in Kotlin?
Correct Answer: C — Simplifies accessing properties and methods of an object
Explanation:
The with function helps access properties and methods of an object without repeating its reference.
val person = Person("Alice", 30)
with(person)
{
println("Name: age")
}