Skip to content

Match with already defined variables (ie constants) #5

Open
@programmeroftheeve

Description

@programmeroftheeve

It should be able to match with constants.

Example:

using Rematch
module Mod
    const VALUE = 0
end
import .Mod

const FOO = 1
const BAR = 2
const FOOBAR = 3
const BAR_FOO = 4

x = FOO

y = @match x begin
    Mod.VALUE => :mod_value
    FOO => :foo
    BAR => :bar
    FOOBAR => :foobar
    BAR_FOO => :barfoo
    _ => nothing
end

@assert y == :foo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions