Comments in Apps Script
You can add comments to your code to help others understand what your code does. Apps Script will ignore comments so your program's output will not change because of comments.
Single line comments
These are used to add short, one-line comments. Use two forward slashes (//
) to add a single-line comment. Apps Script will ignore all the text following //
on the same line.
// This is a single-line comment.
var maxPrice = $1000; //max price was decided by John Raymond (VP sales)
Multi-line comments
These are used to add more detailed comments in your code. As the name suggests, these can span multiple lines.
Use a forward slash and an asterisk (/*
) to start a multi-line comment and an asterisk and forward slash (*/
) to end it. Apps Script will ignore the text in-between /*
and */
.
/*
This helpful comment describes what the myFavNumber function does.
The myFavNumber function returns Ryan Jackson's favorite number.
Ryan's favorite number keeps changing so this function was last updated in June 2019.
The next update will be made in July 2019.
*/
function myFavNumber() {
return 3;
}
Master Google Sheets Automation
I'd appreciate any feedback you can give me regarding this post.
Was it useful? Are there any errors or was something confusing? Would you like me to write a post about a related topic? Any other feedback is also welcome. Thank you so much!