3. Number

A number data type contains as you probably have already guessed, numbers.

Here are some examples of numerical data:

Item Value
Weight in Kg 12.25, 19.99, 199.99
Room measurement in metres 14.5
Temperature (degrees Celsius) 37.5

When you choose a 'number' data type you may have the option of further refining the data type thus affecting the rules applied to it and the way it is displayed. For example:

Integers

An integer stores whole numbers, either positive or negative. Integers however cannot store numbers with decimal places.

Real or floating point

Your numerical data might need to be formatted with decimal places. This means it cannot be stored as an integer number. Instead it is known as a 'real' number. You can specify the number of decimal places that you need.

Currency

When you choose to format numerical data as currency then it will automatically be given two decimal places. However, you can choose to format currency with no decimal point because in some circumstances it would not be appropriate to display the pence. Think of an estate agent, they might sell a house for £295,000. It would look daft displayed as £295,000.00.

The currency data type also allows you to display the correct currency symbol such as £ or $.

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Integer Data Type