Primitive Types
Beginner · Fundamentals
Go’s built-in types: booleans, numeric types (int, int8…64, uint…,
float32/64, complex), byte (alias for uint8), rune (alias for int32),
and string. Conversions between numeric types must be explicit.
Resources
Section titled “Resources”Exercises
Section titled “Exercises”primitive_types1 compile
Section titled “primitive_types1 compile”Toggle a boolean before the second check.
Show hint
Update the code to reflect the store closing before the second check.primitive_types2 compile
Section titled “primitive_types2 compile”Declare the string before formatting it.
Show hint
Make sure 'who' is declared and assigned a value before using it.primitive_types3 compile
Section titled “primitive_types3 compile”Declare the variables passed to Printf.
Show hint
fmt.Printf() can take multiple variables as parameters. Try declaring those variables.primitive_types4 compile
Section titled “primitive_types4 compile”Store a character in a byte value.
Show hint
byte can hold values from 0 to 255. Could it store a character?primitive_types5 compile
Section titled “primitive_types5 compile”Use Go’s real numeric type names.
Show hint
These names seem misleading, no? But they are close to being correct.Check this documentation to understand the variety ofnumeric data types: https://go.dev/ref/spec#Numeric_types