You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
레이블(Lable) 은 코드 블록이나 루프에 이름을 붙여 특정 지점을 지칭하는 기능이다.
주로 중첩 루프에서 특정 루프를 탈출하거나, 람다 함수 내에서 반환 대상을 명확히 할 때 사용된다.
예시
users.forEach loop@{
if (it.isActive) {
println("Active user: ${it.name}")
return@loop // 현재 람다 호출만 종료하고, forEach는 계속 진행 (continue 와 똑같이 동작)
}
println("Inactive user: ${it.name}")
}
println("Processing completed.")
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
레이블(Lable) 은 코드 블록이나 루프에 이름을 붙여 특정 지점을 지칭하는 기능이다.
주로 중첩 루프에서 특정 루프를 탈출하거나, 람다 함수 내에서 반환 대상을 명확히 할 때 사용된다.
예시
users.forEach loop@{ if (it.isActive) { println("Active user: ${it.name}") return@loop // 현재 람다 호출만 종료하고, forEach는 계속 진행 (continue 와 똑같이 동작) } println("Inactive user: ${it.name}") } println("Processing completed.") }viewModelScope.launch { successUiState?.let { state -> if (state.pokemon.id == pokemonId) { _navigationEvent.emit(NavigationEvent.ToPokemonDetail.Failure(state.pokemon.name)) return@launch } _navigationEvent.emit(NavigationEvent.ToPokemonDetail.Success(pokemonId)) } }Beta Was this translation helpful? Give feedback.
All reactions