Skip to content

return statement weird behaviour in version 0.77 #8472

@presidento

Description

@presidento

Describe the bug

I cannot parse the breaking change from release notes, but it seems that the behaviour of return command has changed.

How to reproduce

Save this to test-return.nu file:

def get_a_number [] { return 222 }

def example_command [] {
    if (get_a_number) > 10 {
        echo "Big"
    } else {
        echo "Small"
    }
}

example_command

With 0.76

❯ nu --version; nu test-return.nu
0.76.0
Big

With 0.77

❯ nu --version; nu test-return.nu
0.77.0
222

Expected behavior

I expected nu 0.77 work as in 0.76. Or have a big warning about this braking change in relese notes.

Screenshots

No response

Configuration

0.76

key value
version 0.76.0
branch
commit_hash bc38a6a
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.67.1 (d5a82bbd2 2023-02-07)
cargo_version cargo 1.67.1 (8ecd4f20a 2023-01-10)
pkg_version 0.76.0
build_time 2023-02-23 08:03:29 -06:00
build_rust_channel release
features database, default, trash, which, zip
installed_plugins

0.77

key value
version 0.77.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.68.0 (2c8cc3432 2023-03-06) (built from a source tarball)
cargo_version cargo 1.68.0 (115f34552 2023-02-26)
build_time 2023-03-14 18:46:42 +00:00
build_rust_channel release
features default, zip
installed_plugins

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions