Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add finally support to matches #32

Open
MadcapJake opened this issue Sep 29, 2015 · 0 comments
Open

Add finally support to matches #32

MadcapJake opened this issue Sep 29, 2015 · 0 comments

Comments

@MadcapJake
Copy link

Support a finally branch that runs after every possible branch. Perhaps not running after else?

var hidden = false
var opacity = 0.0
nudge-opacity = match ->
   up?     -> opacity += 0.1
   down?   -> opacity -= 0.1
   finally -> if opacity == 0.0: hidden = true

A return value could be handled in two ways (not sure how easy either route would be to implement):

  1. Via an argument prior to the match's -> operator: finally rval -> ...
  2. Via the body of the branch (optionally) being a function: finally -> rval -> ...

This was discussed on gitter at one point and I just remembered it and wanted to get it logged.

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

No branches or pull requests

1 participant