# Local Variable

*noun*

say it: **“LOH-kul VAIR-ee-uh-bul”** **/ˈloʊkəl ˈvɛəriəbəl/**

A variable declared inside a method or a block, which exists only there and only while that code runs.

## What is **Local Variable** in C#?

**Local Variable** — A variable declared inside a method or block and usable only there.

```csharp
class Game
{
    void UpdateScore()
    {
        int score = 10;
        score = score + 5;
    }
}
```

## In a sentence

- “gamesPlayed is a **local variable** of ShowRecord, so the top of the program can't print it.”

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

Updated: November 18, 2026

## In other subjects

- [Local Variable in Java](https://www.ask-codey.com/glossary/local-variable-java)
- [Local Variable in Python](https://www.ask-codey.com/glossary/local-variable)
- [Local Variable in Unix](https://www.ask-codey.com/glossary/local-variable-unix)

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