# Casting

In Snowball, casting refers to the process of converting a value from one type to another. It allows you to explicitly change the interpretation or representation of data to match a different type. Casting is useful when you need to perform operations that require compatible types or when you want to ensure proper type compatibility. Here are the casting mechanisms available in Snowball:

```rust
let a = myInteger as f32; // 'a' has a type of f32 now
```

This type of casting is used to explicitly convert a value to a specified target type. The target type must be compatible with the original value, ensuring proper type conversion. Casting to parent types is allowed, while casting to child types requires the use of `dyn_cast<...>(...)` to perform dynamic type checking.


---

# 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://snowball-lang.gitbook.io/docs/language-reference/casting.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.
