Question - What are labels in Kotlin?
Answer -
Any expression written in Kotlin is called a label. For example, if we are having a for-loop in our Kotlin code then we can name that for-loop expression as a label and will use the label name for the for-loop.
We can create a label by using an identifier followed by the @ sign. For example, name@, loop@, xyz@, etc. The following is an example of a label:
loop@ for (i in 1..10) {
// some code goes here
}
The name of the above for-loop is loop.