VariablesAny data that needs to be held in memory is stored temporarily in a location called a variable. It's variable because the value can be altered- ie it may vary during the lifetime of an application.
These are the main types of variables.
- Numbers- Integer.
- Numbers - Floating Point.
- Enumerated Types - a limited set of integer values.
- Bool - a true/false variable.
- Text Strings.
- Arrays - a a multi dimensional list of variables.
- Structs - A conglomerate variable.
- Nullable Types.
- Objects- A conglomerate of data plus methods (functions) that control access to the object's data.
- Generic Types. Used for creating general classes that are instantiated for a particular type.
Numeric VariablesThese divide neatly into two types- those that are whole numbers and have no fractional parts (called integers, int for short) and floating point numbers (float). CPUs use different parts of their silicon for working on floating point to integer. Integers are often smaller and faster to process.
On the next page : Integer Types