SHOW:
|
|
- or go back to the newest paste.
| 1 | - | def name = 'Duke' |
| 1 | + | def range1 = 'a'..'d' |
| 2 | - | println """Hello ${name},
|
| 2 | + | assert range1 == ['a','b','c','d'] |
| 3 | - | |
| 3 | + | |
| 4 | - | Today we are the ${new Date()}
|
| 4 | + | def list = [0,1,2,3,4,5] |
| 5 | - | |
| 5 | + | |
| 6 | - | Good Bye""" |
| 6 | + | def range2 = list[0..<3] |
| 7 | - | //Hello Duke, |
| 7 | + | assert range2 == [0,1,2] |
| 8 | - | // |
| 8 | + | |
| 9 | - | // Today we are the Thu Dec 06 21:05:44 UTC 2012 |
| 9 | + | def range3 = list[0..-1] |
| 10 | - | // |
| 10 | + | assert range3 == [0,1,2,3,4,5] |
| 11 | - | // Good Bye |
| 11 | + | assert range3[0..-3] == [0,1,2,3] |