From d8ec4781253d701c4d1d3c531166f5129de7acbb Mon Sep 17 00:00:00 2001 From: A4-Tacks Date: Mon, 1 Jan 2024 07:13:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BAmatch=E7=A4=BA=E4=BE=8B=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E4=B8=AA=E7=BB=91=E5=AE=9A=E9=87=8F=E7=9A=84?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/match.mdtlbl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/examples/match.mdtlbl b/examples/match.mdtlbl index 5b832d8..05a83d6 100644 --- a/examples/match.mdtlbl +++ b/examples/match.mdtlbl @@ -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 +*#