All clauses of a function return the same type. Here one clause declares a different return type than an earlier one.
Wrong#
fn name(0): str = "zero"
fn name(n: int): int = nFixed#
fn name(0): str = "zero"
fn name(n: int): str = str(n)Common causes#
- A typo in one clause's return type.
- A clause that should convert its result (
str(n),float(n)). - Write the return type once in a header line (
fn name(n: int): str) above the clauses.