Skip to content

Return as variable #169

@bvssvni

Description

@bvssvni

Dyon allows you to assign a value to return, as if it was a normal local variable:

fn foo() -> {
     return = 4
     return = 5
     // will return 5
}

This requires -> on the function.

The return value outlives the arguments of the functions, unless they have a lifetime. If you assign to it, the right expression must outlive 'return.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions