> For the complete documentation index, see [llms.txt](https://calnotes.gitbook.io/cs61a-guidebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://calnotes.gitbook.io/cs61a-guidebook/building-blocks/introduction-to-functions/functions-that-dont-return-anything.md).

# Functions that Don't Return Anything

A curious sub-category of functions in Python.

A function, typically, returns a value. **Keyword: "typically".** Consider a function like so:

```python
def f(x):
	print(x)
```

This is a completely valid function that takes in a value `x` and prints it. Notice how this function does not return anything.

Now, for a contradictory fact: **all Python functions return a value.**

How does this work? When we don't return any value, Python does it for us. Let's try this in our interpreter.

```python
>>> def f(x):
>>> ...  print(x)
>>> r_val = f("hi")
hi
>>> r_val
>>>
```

You'll notice how prompting `r_val` on the terminal does not return anything — this is because `r_val` is `None`.

This, we now know a deep fact about Python — that it implicitly returns `None` when no other value is returned.

```python
def f(x):
	print(x)
	# return None # implicitly!
```
