Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Suggestion: show a try...catch...finally example #30

Open
mark-summerfield opened this issue Mar 6, 2017 · 0 comments
Open

Suggestion: show a try...catch...finally example #30

mark-summerfield opened this issue Mar 6, 2017 · 0 comments

Comments

@mark-summerfield
Copy link

mark-summerfield commented Mar 6, 2017

In http://docs.julialang.org/en/latest/manual/control-flow.html
it explains that try ... catch and try ... finally can be combined. I'm guessing that this means something like:

file = open("filename")
try
    # read file
catch err
   # report err
finally
    if file !== nothing
        close(file)
    end
end

But the whole point of a manual is that readers shouldn't have to guess:-)

Also, if there's a way to do this more nicely for files (like the open(f::Function... example shown earlier but built-in or in the std. lib.), it should be mentioned and linked to.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant