Home »
Code Examples »
Groovy Code Examples
Groovy - Create and access the global variables Code Example
Here is the solution for "Create and access the global variables" in Groovy.
Groovy code for Create and access the global variables
import groovy.transform.Field
one = 'one_value'
@Field String two = 'two_value'
def three = 'three'
void printVars() {
println one
println two
println three // This won't work, because not in script scope.
}
Code by IncludeHelp,
on March 13, 2023 22:39