What is a variable?

Experience Level: Junior
Tags: C#

Answer

A varialbe is a container for holding a value of a specific type.

If you want to sum two numbers, you might use 3 variables. 2 variables for holding two numbers that are to be added and one variable for storing the result.

In the following example, the number 4 is stored to the variable a. Number 6 is stored to the variable b. Then the values of these two variables are added and the result is stored to the variable c, so the variable c now holds value 10;

var a = 4;

var b = 6;

var c = a + b;

Remembner: Before you can use a variable you have to declare it.

Comments

No Comments Yet.
Be the first to tell us what you think.
C# for beginners
C# for beginners

Are you learning C# ? Try our test we designed to help you progress faster.

Test yourself

Chat

Oh, the operator is not available. Leave us your comments. We will answer all your questions as soon as possible.

Comments

Anonymous
Καλησπέρα.
Anonymous
the infinteis -3/15 so 1triition / infinet
Anonymous
e
Anonymous
<a href="https://inspirum.pl "
Anonymous
[url]https://inspirum.pl[/url]
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e