Mwnci Comments

Mwnci Comments

  • Comments can be used to describe code
  • Comments can be used to make code more readable
  • Comments can be used to prevent code execution when testing

Creating Comments

Comments start with  //, and will be ignored  by the interpreter

// print message
println("Hello World")

Comments can be placed at the end of a line, and will also be ignored by the interpreter.

x=y+1  // This is also a comment

Comments can also prevent code from being executed, say for testing

// println("Hello Mum")
println("Hello World")

Multiline Comments

To insert multiline comments, you can either start each line with //, or used the C-type /*…*/ to encapsulate several lines.

// These lines
// are comments

/*
This is
also comments
over several
lines
*/