Created
December 6, 2013 05:02
-
-
Save aya-eiya/7818833 to your computer and use it in GitHub Desktop.
Groovyのちょっとしたこと「Scriptのローカル変数のスコープ」 ref: http://qiita.com/aya_eiya/items/32876e8693b77f4277f3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def myVar = 'myvar' | |
def callMyVar() { | |
println myVar | |
} | |
callMyVar() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.transform.* | |
@Field | |
def myVar = 'myvar' | |
def callMyVar(){ | |
println myVar | |
} | |
callMyVar() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def myVar = 'myvar' | |
def callMyVar = { | |
println myVar | |
} | |
callMyVar() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment