# Basic Types

Go does have a wide range of built-in types as well as allows the programmer to define custom types. We would discuss these later in depths. Here are some basic types that one should know before proceeding forward

```go
bool // holds boolean values
string // holds string values
int  int8  int16  int32  int64 // signed integer values
uint uint8 uint16 uint32 uint64 uintptr // unsigned integer values
byte // same as uint8
rune // alias for int32, represents a Unicode code point
float32 float64
complex64 complex128
```

Bit size of int, uint, uintptr depends on system architecture. On 32 bit system, they would be assumed to 32 bit wide, while on 64 bit system, they would be 64 bit wide.

Usually using `int` should suffice unless we have specific reason to use signed, unsigned or other varying types of integers/floats.

## Type Conversions

Go allows type conversion from one type to another via `T(v)` where `T` is type to cast to `v` is value to be typecasted.

{% hint style="warning" %}
In Golang, var of one type can not be assigned value of other type unless converted
{% endhint %}

```go
var age int = 23
var agef float64 = float64(age)
var ageu uint = uint(agef)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://golang.bagwanpankaj.com/basic-types.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
