1..10 - An example of an inclusive Range
1..
‘a’..’x’ – Ranges can also consist of characters
10..1 – Ranges can also be in descending order
‘x’..’a’ – Ranges can also consist of characters and be in descending order.
sequence of values, first and last sequence
class Example {
static void main(String[] args) {
def range = 5..10;
println(range);
println(range.get(2));
}
}
[5, 6, 7, 8, 9, 10]
7
No comments:
Post a Comment