3
// Single-line comment. TODO markers work.
10
def tsq = '''Triple single-quoted string.
12
Escapes work: \' \n \123 \u12ab \
13
Interpolation doesn't work: $x ${x}
16
def sq = 'Single-quoted string. Escapes work: \' \r \45 \u45CD \
17
Interpolation does not: $x ${x}'
19
def tdq = """Triple double-quoted string.
21
Escapes work: \" \f \6 \uABCD \
22
Interpolation works: $x._y.z0 ${x + 5}
25
def dq = "Double-quoted string. Escapes work: \" \b \7 \u5678 \
26
So does interpolation: $_abc1 ${x + "abc"}"
28
def slashy = /Slashy string.
30
There are only two escape sequences: \/ \
31
Interpolation works: $X ${-> X}
32
Dollars $ and backslashes \ on their own are interpreted literally./
34
def notSlashy = 1 /2/ 3 // not a slashy string; just two division operators
36
def dollarSlashy = $/Dollar slashy string.
38
There are three escape sequences: $$ $/ \
39
Interpolation works: $_ ${true}
40
Dollars $ and backslashes \ on their own are interpreted literally./$
42
0b10i + 0b0110_1011 // binary numbers
43
0 + 123L + 456_789 // decimal numbers
44
0xab + 0xcd_efG // hexadecimal numbers
46
01_23.45_67g + 1e-23f + 2d + 08.80 // floating-point numbers
51
for (n in list) sum += n as int