Simple Data Types
Simple data types means they only store one, that is a single value, there are four:
- Strings
- Numbers
- Booleans
- Errors
See the Standard Library docs here: https://pkg.go.dev/std
Strings
Strings in Go represent one or more characters.
Interpreted use double quotes strings will honour the escape character:
Raw strings don't:
Nor to raw string care about white space, so they can do multiple lines, for example:
Numbers
Number in Go come in 4 flavours:
- Integers (
1
,42
,-42
) -int
- Unsigned integers (
0
,32
,8080
) -uint
- Floating point numbers (
5.01e20
,3.1415
) -float32
&float64
- Complex numbers (
0.833i
) -complex64
&complex128
Booleans
Boolean is either true
or false
.
Error
A conventional interface representing an error condition.