Go Constants

In this tutorial you will learn about the Go Constants and its application with practical example.

Go Constants

Constants refers to immutable values. Constants are basically literals whose values cannot be modified or changed during the execution of program. The Constants are created in the same way you create variables but instead of using the var keyword we use the const keyword and by convention constant names are always uppercase.

Table Of Contents

Syntax :-

Here, <constant_name> can be replaced with constant name.

Example :-

Go Escape Sequence

Escape sequence is a special string comprise a backslash (\) followed by a letter or by a combination of digits used to control output on monitor. Escape sequences are typically used to represent actions such as newline,carriage returns,tab movements and non printing characters over the monitor. The following table lists the common ANSI escape sequences and their meaning.

Escape sequence Meaning
\\ \ character
\’ ‘ character
\” ” character
\? ? character
\a Alert or bell
\b Backspace
\f Form feed
\n Newline
\r Carriage return
\t Horizontal tab
\v Vertical tab
\ooo Octal number of one to three digits
\xhh . . . Hexadecimal number of one or more digits

In this tutorial we have learn about the Go Constants and its application with practical example. I hope you will like this tutorial.