浏览 2449 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-05-09
In groovyConsole, execute (Ctrl + R) following code: """ ${ println "Hi" } """ result: Hi Cool, isn't it? How about this? """ ${ class Foo{} } """ No way...Why? The curly braces denote a closure, So, we can put anything valid in a closure into the ${} within a HERE DOC: a = [1,2,3,4,5,6] """ ${ a.each {print it} } """ result: 123456 Wow, closure within closure. So below is nothing strange: """ ${ println """ ${println "Can you see me?"} """ } """ result: yes, I can :) 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2007-05-09
这个语法实在是非同一般的恶心啊
|
|
返回顶楼 | |