Return type declarations

Whereas type hints ensure input consistency, return type declarations ensure output consistency.

We use a colon before the opening curly brace of a function to hint the return type.

The same strictness rules apply as with the type hints: if “strict mode” is disabled, return values that can be converted to the preferred type are allowed. If you enable “strict mode” this code will throw a type error.