Comments
- Comment is human-readable text used to annotate your code with an explanation of what is happening.
- Comments are ignored by our system, rather they help you describe what a piece of code is doing.
- There are two different ways to write a comment
Single-line comment
- Single line comments start with double slashes
//.
// This is a comment
def int i = 12;
def string a = "nice"; // This is also a comment
Multi-line comment
- Multi-line comments are enclosed within
/*and*/
/* This is a very, very
large comment. It does not fit
in one line */
def int i = 12;
def string a = "nice";
Tip
It's a considered a good practice to always comment your code. It not only helps your collaborators, it also helps you when you look at your code after a long time.