# Common Code Syntax & Data Types

While every programming language has its own unique syntax, many share fundamental concepts regarding data types and variable declaration. Understanding these commonalities makes learning new languages significantly easier.

## 1. Variables

A variable is a container for storing data values.

### Declaration
Different languages handle variable declaration differently, often depending on whether they are **statically typed** (type must be known at compile time) or **dynamically typed** (type is determined at runtime).

*   **JavaScript (Dynamic):**
    ```javascript
    var name = "John"; // Old way (function scoped)
    let age = 30;      // Modern way (block scoped)
    const PI = 3.14;   // Constant (cannot be reassigned)
    ```
*   **Java/C++ (Static):**
    ```java
    int score = 10;
    String message = "Hello";
    ```
*   **Python (Dynamic):**
    ```python
    score = 10      # No keyword needed
    message = "Hi"
    ```
*   **PHP (Dynamic):**
    ```php
    $score = 10;    # Variables start with $
    ```

## 2. Integers (`int`)

An **Integer** is a whole number without decimals. It can be positive or negative.

*   **Examples:** `0`, `42`, `-99`, `1024`
*   **Usage:** Counting, array indices, loop counters.

```c
// C Example
int count = 5;
```

## 3. Floating Point Numbers (`float`, `double`)

Floating point numbers represent real numbers with fractional parts (decimals).

*   **Float:** Single precision (usually 32-bit). Less precise, takes less memory.
*   **Double:** Double precision (usually 64-bit). More precise.

*   **Examples:** `3.14`, `-0.001`, `2.0`

```java
// Java Example
double price = 19.99;
float tax = 0.05f;
```

## 4. Strings

A **String** is a sequence of characters used for text.

*   **Syntax:** Usually enclosed in double quotes `"` or single quotes `'`.

```python
# Python Example
greeting = "Hello World"
name = 'Alice'
```

## 5. Booleans (`bool`)

A **Boolean** represents one of two values: logical true or false.

*   **Values:** `true`, `false` (sometimes `1` and `0`).
*   **Usage:** Conditional logic (if statements).

```typescript
// TypeScript Example
let isActive: boolean = true;
let hasFinished: boolean = false;
```