// DOCS NAVIGATION
Tipos_
SOURCE: content/docs/reference/06-referencia-rapida.md — 06 Referência Rápida / 3. Tipos / Types
Primitivos / Primitives
| Tipo | Tamanho / Size | Valores / Values | Exemplo |
|---|---|---|---|
int | 64-bit signed | -2⁶³ … 2⁶³-1 | 42, -7, 0 |
float | 64-bit IEEE 754 | ±1.8×10³⁰⁸ | 3.14, -0.5 |
bool | 1-bit | true, false | true |
string | Ponteiro UTF-8 | qualquer texto | "hello" |
char | Unicode codepoint | caractere único | 'a', '\n' |
unit | 0 bits | () | implícito |
Compostos / Composite
| Tipo | Sintaxe | Exemplo |
|---|---|---|
| Array | [T; N] | [1, 2, 3] |
| Array dinâmico | [T] | let a: [int] = [1, 2, 3] |
| Tupla | (T1, T2) | (1, "hi") |
| Record | record Nome { ... } | Ponto { x: 0, y: 0 } |
| Enum | enum Nome { ... } | Cor::Azul |
| Option | Option<T> | Option::Some(42) |
| Result | Result<T, E> | Result::Ok(v) |
Compatibilidade / Compatibility
| De / From | Para / To | Como / How |
|---|---|---|
int | float | std.convert.int_to_float(x) |
float | int | std.convert.float_to_int(x) (trunca / truncates) |
int | string | std.convert.int_to_string(x) |
float | string | std.convert.float_to_string(x) |
bool | string | std.convert.bool_to_string(x) |
bool | int | std.convert.bool_to_int(x) → 0 ou 1 |
string | int | std.convert.string_to_int(x) (0 se erro) |
string | float | std.convert.string_to_float(x) (0.0 se erro) |
int↔float | operação mista | ERRO — deve converter explicitamente |
int↔bool | aritmética | ERRO — bool não é numérico |