Skip to main content
InterviewHubPRO
Section Overview
Q7

Question 7 of 50

Part 1: Core Language, Type System & Syntax (1 - 10)

14%
Kotlin & Coroutines (50 Qs)•Part 1: Core Language, Type System & Syntax (1 - 10)

Explain Kotlin Scope Functions: let, run, with, apply, and also?

junior LevelkotlinCore Language

In Simple Words:

  • apply: Context is this, returns context object (ideal for object initialization).
  • also: Context is it, returns context object (ideal for side-effects/logging).
  • let: Context is it, returns lambda result (ideal for null-checks ?.let).
  • run: Context is this, returns lambda result (ideal for computation on object).
  • with: Non-extension function taking object as argument, returns lambda result.