bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Go/Go Tutorial
Go•Go Tutorial

Go Data Types

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Go Data Types?

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
3Order

Put the learning moves in the order that makes the concept easiest to apply.

- bool : represents a boolean value and is either true or false - Numeric : represents integer types, floating point values, and complex types - string : represents a string value
Go is statically typed, meaning that once a variable type is defined, it can only store data of that type.
Data type is an important concept in programming.

Data type is an important concept in programming. Data type specifies the size and type of variable values.

Go is statically typed, meaning that once a variable type is defined, it can only store data of that type.

Go has three basic data types

  • bool : represents a boolean value and is either true or false
  • Numeric : represents integer types, floating point values, and complex types
  • string : represents a string value

Example

package main
import ("fmt")
func main() {
  var a bool = true
  // Boolean var b int = 5 // Integer var c float32 = 3.14 // Floating point number var d string = "Hi!" // String fmt.Println("Boolean: ", a) fmt.Println("Integer: ", b) fmt.Println("Float:     ", c) fmt.Println("String:  ", d)
}

Previous

Go Formatting Verbs

Next

Go Boolean Data Type