> For the complete documentation index, see [llms.txt](https://wu-lang.gitbook.io/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wu-lang.gitbook.io/guide/syntax/variables.md).

# Declarations

> "Like most languages I can think of, Wu's data handling is highly based around the concept of variables." - Bruce Lee

## Primitives

Variables are highly dependent on types to decide what they want inside them:

```rust
fruit: str = "milk"
fruit = 10
```

As the smart reader might realize, this code is invalid in the way that it's not okay to store numbers in a `str`.

By omitting types in you variable declarations, it doesn't mean the variable won't have a type; you simply pass on the job of figuring out the type onto the compiler.

```fsharp
favorite_number: int = 0  # an int, pff
least_favorite := 100     # also an int ?!
```

Now would you take a look at all these amazing types:

```fsharp
weight:  int   = 83
height:  float = 187.75
name:    str   = "neils"
letter:  char  = 'u'
uses_wu: bool  = true
```

## Casting

Of course, to prevent weird behavior in Wu programs, it's illegal by default to operate values of different types than what is expected. In special scenarios though, it's super useful to be able to use a value as something it isn't(or might be).

This is done using the `as` keyword:

```fsharp
# this will cold-bloodedly floor 10.5 to 10
banana: int = 10.5 as int
```

With great power comes great responsibility ... the latter, Wu won't bother you with, thus you might get *constructive critique* for casting things which should not be cast.

```rust
banana: int = "100" as int
```

```
wrong: can't cast `str` to `int`
     --> projects/spiderman.wu
      │
    1 │ banana: int = "100" as int
      |
```

## Splats

You can declare multiple values at once like the following:

```fsharp
a, b := 1, 2
```

These are also useful for returning multiple values:

```fsharp
foo: fun {
  1, 2
}

bar: fun {
  return 1, 2
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://wu-lang.gitbook.io/guide/syntax/variables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
