-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgroovy.nf
More file actions
84 lines (51 loc) · 944 Bytes
/
groovy.nf
File metadata and controls
84 lines (51 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
println "Hello, World!"
// comment a single config file
/*
a comment spanning
multiple lines
*/
x = 1
println x
x = new java.util.Date()
println x
x = -3.1499392
println x
x = false
println x
x = "Hi"
println x
def x = 'foo'
list = [10,20,30,40]
println list[0]
println list.get(0)
println list.size()
map = [a:0, b:1, c:2]
map['a'] = 'x'
map.b = 'y'
map.put('c', 'z')
assert map == [a:'x', b:'y', c:'z']
foxtype = 'quick'
foxcolor = ['b', 'r', 'o', 'w', 'n']
println "The $foxtype ${foxcolor.join()} fox"
x = 'Hello'
println '$x + $y'
text = """
Hello there James.
How are you today?
"""
println text
list = [1,2,3]
if( list != null && list.size() > 0 ) {
println list
}
else {
println 'The list is empty'
}
list = ['a','b','c']
for( String elem : list ) {
println elem
}
int fib(int n) {
return n < 2 ? 1 : fib(n-1) + fib(n-2)
}
assert fib(10)==89