In this tutorial, we will learn about Comments in Kotlin. Comments are not used to perform any function in the program but they really useful for developers. Developers can write comments with variables and functions to remember their working (purpose) in the program. One important thing to mention comments doesn’t put any impact on the execution of program because compiler simply ignores them.
Page Contents
Types of Comments:
- Single Line comments
- Multi-Line comments
Single-Line Comments:
Single Line comments are used to add single line comment with a variable or any function. Double slash “//’ is used to add Single-Line comments.
fun main(args: Array<String>) {
// Pi variable with value 3.14
val Pi= 3.14
}
Multi-Line Comments:
Multi-Line comments are used to add a multi-line comment with a variable or any function. /* */ symbols are used to add Multi-Line comments.
fun main(args: Array<String>) {
/*Pi variable
with value 3.14*/
val Pi= 3.14
}

Parvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.