Skip to content

Instantly share code, notes, and snippets.

@k-nishijima
Created March 26, 2014 10:44
Show Gist options
  • Save k-nishijima/9780640 to your computer and use it in GitHub Desktop.
Save k-nishijima/9780640 to your computer and use it in GitHub Desktop.
def res = { a, b ->
println "a="+ a + "/ b="+ b
}
println "1:"+ res
println "2:"+ res("1", "2")
println "3:"+ {res("1", "2")}
@k-nishijima
Copy link
Author

で、結果は

1:ConsoleScript4$_run_closure1@3c5a5e89
a=1/ b=2
2:null
3:ConsoleScript4$_run_closure2@1fcd3ed6

になるんですが、そういうものなんですかね。。。
何故2がnullになるの?

環境は
Groovy Version: 2.1.9 JVM: 1.7.0_45 Vendor: Oracle Corporation OS: Mac OS X
です。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment