Variables are data containers that hold specfic types of values.
For Instance, water or a liquid is stored in a bottle, while a cartoon or a box can hold larger solid objects
such as a compute. Similarly, different types of variables are used to hold different types of data.
For storing data, you need to create a variable first by 'declaring' and naming it.
Declaring refers to stating what the specific data-type is.
Assigning refers to giving a specfic value to the variable.
Check the following statement (a line in a computer program)
int x = 3;
A variable named x is created
The Data type is speified as int (short for integer)
It is assigned the value 3
Any decimal point value is considered to be a float or double.
The two common types under this category are float and double.
float: | any fractional or decimal value |
double: | any fractional or decimal value with 15 digits of precision |
Char: | a single character of text |
String: | a block of text with more than one character |
Boolean: | Boolean: Variable can store one of two values: TRUE or FALSE |
Now let us try playing some simple games.
Click the right arrow to move on to the next slide for playing these games
Expirement with various types of data by typing something inside the input box and then press on the "Process" button. The two output boxes below will show the type of data you have entered, and will display a simple 3D object. Try this with numerous entries and see what you can find!
In the game above match the different data types on the left hand side with the type of data type they represent. Click and drag each value into the section they belong once the value is in the right section they will change color. To start the game Maximize it by clicking anywhere on it.
I would like to review again.