Data Types | ||
Data Types: Computers treat different types of data differently. Numbers are not dealt with in the same way that words are. For example, to a computer 4 + 8 means "add 4 and 8" so the result is 12. However "4" + "8" means combine the character "4" and the character "8". In this case the result is the characters "48". Here are some of the more common data types: | ||
Integer: whole numbers (no decimals or fractions) String: letters and numbers that are just characters Examples: Terry, This is a string, She is 15 years old, AER$643*9&HBY. Boolean: this data type can be either True or False There are several other data types but, as a beginner, these will be the types you will use most often. In your program code you need to identify the type of data you are using so the computer will know how to deal with that data. This is done by using a "dim" statement at the beginning of the block of code. In the examples below the code and the result of executing the code are shown | ||
Code: | Result: | |||
| ||||||||