Skip to content

Instantly share code, notes, and snippets.

@e2kaneko
Created September 29, 2012 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e2kaneko/3803048 to your computer and use it in GitHub Desktop.
Save e2kaneko/3803048 to your computer and use it in GitHub Desktop.
GroovyのClosure(クロージャ)スコープ(ローカル変数の束縛)別の書き方
package com.e2info.groovy
a = "xxx"
def c = {
def a = "x_x"
return { println a }
}()
a = "xxx"
println a
c()
/*
xxx
x_x
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment