• +91 9723535972
  • info@interviewmaterial.com

Kotlin Interview Questions and Answers

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.

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners