Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
None Return Value | Function Return Value Specification
course content

Зміст курсу

Python Functions Tutorial

None Return ValueNone Return Value

In Python, None is a special object that represents the absence of a value. If we don't specify any return value, None is used by default.
It is commonly used to indicate that a function does not return any meaningful result. Let's consider different cases when None return value can be used:

First case

When the function does not have a specific result or value to return:

In this case, the function greet() simply prints a greeting message but does not return any specific value. The default return value is None.

Second case

When a function is used for its side effects or actions rather than a return value:

In this example, the function save_data() performs some actions to save data but does not return any specific result. The return value is None, but the focus is on the side effect of saving the data.

Все було зрозуміло?

Секція 4. Розділ 3
course content

Зміст курсу

Python Functions Tutorial

None Return ValueNone Return Value

In Python, None is a special object that represents the absence of a value. If we don't specify any return value, None is used by default.
It is commonly used to indicate that a function does not return any meaningful result. Let's consider different cases when None return value can be used:

First case

When the function does not have a specific result or value to return:

In this case, the function greet() simply prints a greeting message but does not return any specific value. The default return value is None.

Second case

When a function is used for its side effects or actions rather than a return value:

In this example, the function save_data() performs some actions to save data but does not return any specific result. The return value is None, but the focus is on the side effect of saving the data.

Все було зрозуміло?

Секція 4. Розділ 3
some-alt