# var

*noun*

say it: **“VAR”** **/vɑːr/**

A C# keyword that lets the compiler work out a local variable's type from the value you give it.

## What is **var** in C#?

**var** — A keyword asking the compiler to infer a local variable's type from its value.

```csharp
class City
{
    void NormalizeName()
    {
        var name = "Denver";
        var uppercaseName = name.ToUpper();
    }
}
```

## In a sentence

- “I wrote **var** total = 0m; and the compiler knew total is a decimal.”

Level: Apprentice · [More C# terms at this level](https://www.ask-codey.com/glossary?category=c-sharp&level=2)

Updated: November 9, 2026

## In other subjects

- [var in Java](https://www.ask-codey.com/glossary/var)
- [var in JavaScript](https://www.ask-codey.com/glossary/var-javascript)

Source: https://www.ask-codey.com/glossary/var-c-sharp
