TL ; DR:
Comments are lines of code that Go intentionally ignores. They are notes for humans.
You add a single-line comment in Go by typing
//followed by text:// This is a comment fmt.Println("This is not a comment")
Full lesson:
Comments help explain what code does without changing what the program runs.
Go supports single-line comments:
// Next line will greet the user:
fmt.Println("Hello user!")
Go also supports multi-line comments:
/* This is a
multi-line comment */
fmt.Println("Hello user!")
Assignment
Follow the Coding Tutorial and let's write a comment!
Hint
Use // for a single-line comment.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
