Skip to content

disallow return outside function? #30499

@krrutkow

Description

@krrutkow

On v1.0.2 I used a return statement from within a let block that got assigned to a variable. This didn't work as I expected, but it also didn't cause any errors. The surprising side effect was that the variable assigned to was never actually created.

julia> x = let
           # some ugly calc
           42
       end
42

julia> x
42

julia> y = let
           # some ugly calc
           return 42
       end
42

julia> y
ERROR: UndefVarError: y not defined

Metadata

Metadata

Assignees

Labels

docsThis change adds or pertains to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions