0
what is variable
5 Antworten
+ 6
A variable is like a box.
You create a box with a name.
int x; // Empty variable, Empty box.
int y = 5; // Here we put 5 into this variable or box.
Console.Write(y); // Here we open the box and use what we put inside it. So the output will be 5.
// With our empty box x, we can put values inside of it.
x = 10; // Here we open our box and puts 10 inside it.
It's the same thing with all variable types.
+ 6
A variable holds a value which can be changed during the execution of the program.
int myVar; //declaration of a variable of type int (integer)
myVar = 42; //assignment of the value 42
Console.Writeln(myVar); //prints the value
+ 2
variable is used to store Data Values (storage location)
+ 2
variable is a container that stores the data
- 2
wow superb answers