Skip to content

Commit

Permalink
为match示例添加一个绑定量的示例
Browse files Browse the repository at this point in the history
  • Loading branch information
A4-Tacks committed Dec 31, 2023
1 parent b129ddd commit d8ec478
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/match.mdtlbl
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,27 @@ match yes {
#* >>>
print "ok"
*#


# 将匹配值绑定
const Foo = (
match @ {
X:[a b c] {
print "yes!"X;
}
X {
print "no."X;
}
}
);
take Foo[a];
take Foo[b];
take Foo[d];
#* >>>
print "yes!"
print a
print "yes!"
print b
print "no."
print d
*#

0 comments on commit d8ec478

Please sign in to comment.