Groovy 这个词是什么意思;“循环”;在GPAR的示例中是什么意思?
下面我们有一个单词Groovy 这个词是什么意思;“循环”;在GPAR的示例中是什么意思?,groovy,gpars,Groovy,Gpars,下面我们有一个单词loop: def decryptor = actor { loop { react { message -> if (message instanceof String) reply message.reverse() else stop() } } } def console = actor { decryptor.send 'lellarap si yvoorG
loop
:
def decryptor = actor {
loop {
react { message ->
if (message instanceof String) reply message.reverse()
else stop()
}
}
}
def console = actor {
decryptor.send 'lellarap si yvoorG'
react {
println 'Decrypted message: ' + it
decryptor.send false
}
}
[decryptor, console]*.join()
如何确定,是什么?如果我在IntelliJ
中按住Ctrl键单击它,我将一无所获。同时,如果我按住Ctrl键单击工作react
,则转到
它也有。但两者都没有单个闭包作为参数
我可以确定,这里调用了一些循环
方法吗?请相信这里的构造函数是单参数可运行的
:在groovy中,尾随闭包将被视为最后一个参数,因此在本例中,提供的可运行代码是react闭包本身-