[Solved] Specifying function / entrypoint return value

Is it necessary to specify return value type, for example:
entrypoint name_exists(name: string) : bool =
Map.member(name, state.map_hamsters)

but, this also compiles:
entrypoint name_exists(name: string) =
Map.member(name, state.map_hamsters)

no, it is not, I’d recommend to do it if its not clear from method name or a complex type

3 Likes

Moreover, it is worth adding this annotation because it’ll make it harder to return wrong value by mistake

3 Likes