+ 2
I didnt understood variables
6 Antworten
+ 7
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.
0
understand it like this
we work on ram ..means whtevr we do it stores on ram
now variable is just a named location in ram were we can store value nd later retrive them
0
variable is the initialize of value.. for example
ones = 10
you can call the 10 with name "ones"
0
int just a number value, not charachter value
0
thanks
- 4
Im still learning so correct me if im wrong
example:
int myName = "Moro"
int = data type
myName = name
"Moro" = value
the three together form a variable. Note: the value isn't necessary to form a variable, but a variable consist of "data type + it's name given by you"