Comments in Scala

Scala comments are used to write some text that may be useful for program readability. Comments are ignored by the compiler and not translated into byte code.

Scala supports single line comments and multiline comments just like Java and the syntax is same as well.

Scala Single Line Comments

Single line comments can be written in a scala program with two forward slashes before the text.

// this is a single line comment in scala

some scala code

// this is another single line comment in scala

Scala Multiline Comments

Multiline comments can be written in a scala program with the text being wrapped between /* and */.

/*this is an example
    method
   */