In Kotlin, when replaces the switch operator of other languages like Java . A certain block of code needs to be executed when some condition is fulfilled. The argument of when expression compares with all the branches one by one until some match is found.3 Oca 2022