Translate

Tuesday 5 October 2021

Creating Closures in Groovy Scripting groovy training telugu 24

 Watch This Video

https://youtu.be/HckcKTZJi0A


--------------------------------------------------------------------------------------------------------------------------

def c ={}
println c.class.name
println c instanceof Closure

def sayHelo={ name ->

println "Hello $name"
}

sayHello('rashmi')

List num=[3,4,5,6,7]
num.each({ nums ->
println nums

})

//closures are object

def timesTen(num,closure){
 closure{num *10}
}

timesTen(10,{println it})
timesTen(2,{println it})

No comments:

Post a Comment

Note: only a member of this blog may post a comment.