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.

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

Updated

In other subjects