Go String Data Type

In Go, the string data type is used to store sequences of characters, often referred to as text. String values must always be enclosed within double quotation marks.

Tutorials dojo strip



Example: Declaring and Using Strings

The following example demonstrates how to declare and initialize string variables, including assigning values at the time of declaration, leaving them uninitialized, and using shorthand syntax.

Go

Output:

The output of the above program will display the type and value of each string variable:

Go

Tutorials dojo strip