Skip to content

Add finally support to matches #32

@MadcapJake

Description

@MadcapJake

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions