Code:
class GroovyController {
def index(){
println '-----------------------------------'
def array1 = [1,2,3,4,5]
def array2 = [6,7]
def array3 = [1,2,8]
println 'Add array1 and array2 : '+(array1 + array2)
println 'Subract array3 from array1 : '+(array1 - array3)
render ''
}
}
Output:
Add array1 and array2 : [1, 2, 3, 4, 5, 6, 7]
Subract array3 from array1 : [3, 4, 5]
class GroovyController {
def index(){
println '-----------------------------------'
def array1 = [1,2,3,4,5]
def array2 = [6,7]
def array3 = [1,2,8]
println 'Add array1 and array2 : '+(array1 + array2)
println 'Subract array3 from array1 : '+(array1 - array3)
render ''
}
}
Output:
Add array1 and array2 : [1, 2, 3, 4, 5, 6, 7]
Subract array3 from array1 : [3, 4, 5]
No comments:
Post a Comment