golang supports comments. A comment is text that is ignored on execution.
but may be useful to the programmer. You can add any kind of text inside
your code.

golang ignores comments. Comments can be single line or multi line.

Quick Start

Comments in golang

Write some code. In this example we output some text.
Then add single and multi line comments.

Copy the code below and save the file as hello.XYZ

1
2
3
4
5
6
7
8
9
10
11
12
package main

import "fmt"

func main() {
/* This is a multi line comment.
You can type within this section */
fmt.Println("Go!")

// single line comment
fmt.Println("Lang!")
}

Video tutorial

Video tutorial below

Exercises

  1. Create a program and add a comment with your name

Download Answers