Groovy Functions


def numbers = 0..9
println numbers.class
for (num in numbers) {
if (isEven(num)) {
  println num
}
}

def isEven(num) {
num%2 == 0
}
​
​

Output of Script

 81 ms
class groovy.lang.IntRange
0
2
4
6
8

Comments

Popular posts from this blog

அவன் ஏன் கூலியானான்?

தட்டு வண்டியில் காளிக்கோயில் - சிறுகதை

Groovy Tuples