Different data types and their uses
- The different data types that is available for creating or developing a program on software. An example of programming software would be Microsoft Visual Studio. With this software, many data types are used which can drive an event.
- The different data types available for programming are String, Integer, Single, Double, Boolean and Date.
- Data Type: String
Use of String: A String can be used as a form of a character e.g. “a” or a string of characters e.g. “abcdefg”. It can be any type of text e.g. “Hello World!”.
• Alphabetic – A to Z, a to z, space
• Special characters - £$%&
• Numbers that are not used for calculations.
- Data Type: Integer
Use of Integer: An Integer can be used as a whole number e.g. a number between 0 and 10. If I had a variable name called First Number as an integer, the code would look like Dim FirstNumber as Integer.
- Data Type: Single Use of Single: A Singlecan be used as decimal numbers with less than 7 significant digits e.g. …show more content…
12345.67
- Data Type: Double
Use of Double: A Double can be used as decimal numbers with less than 14 significant digits e.g. 12345678.78
- Data Type: Boolean
Use of Boolean: A Boolean can be used for a question with two possible answers that a value to a question e.g. is the car yellow? Yes or No. Other range of value can be true or false. As a code, a Boolean would look like Dim answer as Boolean.
Importance of data types - Having data types are important because they each have their own benefits. Benefits of having any sort of data type are its ability to reflect on the type of data being held. E.g. it won’t be suitable if you were to have someone’s date of birth as an integer; it would be suitable if it was as date. - In addition to this, having various of data types is a good thing for a programmer as it can save up on memory as various of data types will have memory bigger than the other e.g. Date having 8 bytes and Integer having 2 bytes. It also saves usages of the CPU of using a variety of data types of where it’s needed. Data types show that valuable storage and faster processing is beneficial towards a programmer. - Data Type: Boolean. A benefit for Boolean is that it can be used for creating both true and false statements. Also, it can be written in both algorithm and coding. - Data Type: String. A benefit for the string data type can hold a number characters or a word like “Morning”. Quotations are needed for the word so that the program knows what word needs to be used. - Data Type: Integer. A benefit for integer is that it allows the programmer to whole number in a code. - Data Type: Double. A benefit for Double is that it can contain more than one digit than a single data type. Also, a Double data type can store twice as much as a Single hence Double having a memory of 8 bytes to 14 bytes and Single having 4 bytes up to 7 bytes. What issues can arise if unsuitable data types are used? - Choosing the correct data types for a variable