skip to content

Control Flow

Branching and looping in Kotlin, where most constructs are expressions rather than statements: if, when with its exhaustiveness rules, for over ranges and iterables, and labeled jumps. Interviewers use this group to check that you have stopped reaching for switch and the ternary operator.

part ofKotlinoverview, primer and where to startread it →
on this pageshow

explore

questions

page 2 of 2

Beyond `return@label`, how are labels (`this@label`) used to disambiguate receivers in nested lambdas with receivers, and how does this relate to return labels?

level: seniorimportance: nice to knowfreq 25%

basics

~10 s

The same @label names that target return@label also qualify this@label. In nested blocks with receivers (like apply inside apply), this@outerLabel lets you reach an outer receiver instead of the innermost one.

open as a page

showing 31–31 of 31