bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Go/Go Tutorial
Go•Go Tutorial

Go String Data Type

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Go String Data Type?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ main

String Data Type

The string data type is used to store a sequence of characters (text). String values must be surrounded by double quotes:

Example

package main
import ("fmt")
func main() {
  var txt1 string = "Hello!"
  var txt2 string
  txt3 := "World 1"
  fmt.Printf("Type: %T, value: %v\n", txt1, txt1)
  fmt.Printf("Type: %T, value: %v\n", txt2, txt2)
  fmt.Printf("Type: %T, value: %v\n", txt3, txt3)
}

Previous

Go Float Data Types

Next

Go Arrays