# Needless conditional statement
In this [[anti-pattern]], there is an unecessary logical fork.
The consequences of this is to increase the [[cognitive complexity]] of the code add [[verbosity]] without changing the outcome.
```python
# Don't
def foo() -> bool:
...
if value:
return True
return False
# Do
def foo(value) -> bool:
...
return value
# Or
def foo(value) -> bool:
...
return bool(value)
```
```python
# Don't
flag = True
if foobar == 10:
flag = False
# Do
flag = foobar != 10
```
```python
# Don't
flag = False
if foobar == 10:
flag = True
# Do
flag = foobar == 10
```
---
Bibliography:
- [Title - website.com](need bibliography)