Go - Basic Syntax

We have already discussed the basic structure of a Go program in the previous chapter.

Tokens in Go

Go application includes numerous tokens.Token is likewise a keyword, an identifier, a constant, a string literal, or a symbol. For example, the subsequent Go assertion includes six tokens:-
fmt.Println("Hello, World Welookups!")
The individual tokens are:
   "Hello, World Welookups!"

Line Separator

Go application, the line separator key's a statement terminator. individual statements don't want a special separator like ";$ in C. The Go compiler internally places “;” as the statement terminator to indicate the end of one logical entity.


fmt.Println("Hello, World Welookups!")
fmt.Println("I am in Go Programming!")


Comments are like helping texts in your Go program and they're left out by way of the compiler. Go start with /* and terminates with the characters */ as shown below here :-
/* my first program  in Go */


Go identifier is a name used to identify a variable, function, or any other user-defined item. identifier starts with a letter a to z or an underscore _ followed by zero or more letters, underscores, and digits (0 to 9).


There are following list the reserved words in Go. These reserved words may not be used as constant variable or constant or any other identifier names.
destroy default func interface pick out
case defer Go map Struct
chan else Goto package deal Switch
const fallthrough if variety Type
hold for import go back Var

Whitespace in Go

Whitespace is used in Go to describe blanks, tabs, newline characters, and comments.A line containing only whitespace, possibly with a comment, is known as a blank line.Whitespaces separate compiler to identify where one element in a statement, such as int, ends and the next element begins.

Therefore, in the following statement −

var age int;