[英]Scala, how to access the whole match: X match {case Y(z) as matched =>
Is there a syntax or way in scala to access the whole matched structure in a case statement? 在scala中是否有语法或方法来访问case语句中的整个匹配结构?
To clarify, if there was an "as" keyword, one could do this: 为了澄清,如果有一个“ as”关键字,可以这样做:
x match {
case Y(z) as matched =>
// do stuff both with "matched" and "z" here ...
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.