> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove Redundant If Statements

#### Sourcery refactoring id: `remove-redundant-if`

#### Description:

Removes conditional tests where the conditional is always `True` or `False`

#### Before:

```python
def hello(name: str):
    if name.startswith("L"):
        self.sing("Hip Hip Horray! For " + name)
    elif not name.startswith("L"):
        self.sing("Hello " + name + ", it's nice to meet you.")
```

#### After:

```python
def hello(name: str):
    if name.startswith("L"):
        self.sing("Hip Hip Horray! For " + name)
    else:
        self.sing("Hello " + name + ", it's nice to meet you.")
```

#### Explanation:

This refactoring will re-structure conditionals where Sourcery determines that
one of the tests is always `True` or `False`. This reveals the actual logic of
the conditional to the reader, making the code easier to understand.

See also: [`remove-redundant-boolean`](/reference/refactorings/python/remove-redundant-boolean/)
