OneBite.Dev - Coding blog in a bite size

create comments in Go

Code snippet on how to create comments in Go

  // This is a single-line comment
  /* 
   This is a
   multiline comment 
  */

This code sample shows two ways to add comments to a Go program. The first way is to add a single line comment, which is preceded with two forward slashes. Anything that follows the two slashes will be ignored by the Go compiler. The second way is to add a multi-line comment, which is enclosed between /* and */. Anything between the two marks will be ignored by the Go compiler. Comments in code can help programmers and other readers of code to understand what the code does and why it is written.

go