# Unit of Code

**Description**:

Instructions executed from a process' entry point until its ending with a verifiable result through one or multiple exit points.

**Composition**:

- [Entry point](https://blog.fiftywords.co/entry-point)
- [Body](https://blog.fiftywords.co/body-unit-of-code)
- [Exit point(s)](https://blog.fiftywords.co/exit-point)

```
class Calculator {
  private currentResult: number = 0;

  // Entry point for the unit of code *add*
  public add(summand: number): number {
    /**
     * Beginning of the unit of code's body
     */

    // Exit point
    this.currentResult += summand;

    // Another exit point
    return this.currentResult;

    /**
     * End of the unit of code's body
     */
  }
}
```

**Examples**:

- A function
- An object method
- A module feature

[🇨🇴 Versión en Español](https://blog.cincuentapalabras.co/unidad-de-codigo)
