Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 521 Bytes

basic-data-types.md

File metadata and controls

19 lines (15 loc) · 521 Bytes

Basic Data Types in Go

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

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
}