04-statements-expressions-comments/questions/03-comments/README.md
package main
/ main function is an entry point /
func main() {
fmt.Println("Hi")
}
package main
// main function is an entry point /*
func main() {
fmt.Println(/* this will print Hi! */ "Hi")
}
package main
/*
main function is an entry point
It allows Go to find where to start executing an executable program.
*/
func main() {
fmt.Println(// "this will print Hi!")
}
1:
/is not a comment. It should be//.2: Multiline comments can be put almost anywhere. However, when a comment starts with
/*, it also needs to end with*/. Here, Go doesn't interpret/* ... */, it just skips it. And, when Go sees//as the first two characters in a code, it skips the whole line.3:
//prevents Go to interpret the rest of the code line. That's why this code doesn't work. Go can't interpret this part because of the comment:"this will print Hi!")
1: This won't help. Sorry.
3: It doesn't matter whether you type your comments using single-line comments or multi-line comments.
godoc and go doc?go doc is the real tool behind godocgodoc is the real tool behind go doc CORRECTgo tool is the real tool behind go docgo tool is the real tool behind godoc2: That's right. go doc tool uses godoc tool behind the scenes. go doc is just a simplified version of the godoc tool.