Programming is writing computer code to create a program, in order to solve a problem. To program a computer, you need to know how programs are constructed.
Sometimes we need computers to remember the informationData that has meaning, not just a number or a letter. we give it and that it calculates during programs. AvariableA memory location within a computer program where values are stored.can be thought of as a box that the computer can use to store a value. The value held in that box can change or 鈥榲ary鈥. A programSequences of instructions for a computer. can use as many variables as it needs it to.
All variables are made up of three parts:
a name
a type
a value
Why use variables?
Variables are extremely useful when programmingThe process of writing computer software.. If a variable is used for the length of a side in a simple program to calculate the perimeter of a square, it is easy to calculate the perimeter of a different sized square, simply by changing the value of the variable.
Variables are a key element of programming. They are used for calculations, for storing values for later use, in decisions and in iteration.