Skip to content

Ability to specify optional return type #7

Description

@duckinator

(Opening as requested by @kayila after talking to her about it.)

While not restricting the return type is a reasonable default behavior for a scripting language, it would be nice to be able to opt-in to it when wanted.

I'm thinking something like this, where the -> int specifies the return type and is optional:

function factorial(int n) -> int {
    if (n == 1) {
        return 1;
    }
    return n * factorial(n - 1);
}

If no return type is specified, it'd probably make the most sense to not restrict it in any way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions