var highscore: int = 0
assigning highscore variable a 0 integer
var ⇒ variable data can be changed
let ⇒ variable data is constant
Types
1. Int:
- Represents whole numbers (positive, negative, or zero).
- Can store values within a specific range depending on its signedness (e.g.,
Int vs. UInt).
- Used for counting, indexing, and calculations where precision beyond whole numbers is not needed.
2. Double:
- Represents floating-point numbers with a wider range and higher precision than
float.
- Stores numbers with decimal parts up to 15-16 significant digits.
- Used for scientific calculations, financial data, and other situations requiring high accuracy.
3. Float:
- Represents floating-point numbers with a smaller range and lower precision than
double.
- Stores numbers with decimal parts up to 6-7 significant digits.