2015-04-20 15:36:01 -07:00
|
|
|
|
//: control/ForEachInt.java
|
2015-05-29 14:18:51 -07:00
|
|
|
|
// <20>2015 MindView LLC: see Copyright.txt
|
2015-04-20 15:36:01 -07:00
|
|
|
|
import static net.mindview.util.Range.*;
|
|
|
|
|
import static net.mindview.util.Print.*;
|
|
|
|
|
|
|
|
|
|
public class ForEachInt {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
for(int i : range(10)) // 0..9
|
|
|
|
|
printnb(i + " ");
|
|
|
|
|
print();
|
|
|
|
|
for(int i : range(5, 10)) // 5..9
|
|
|
|
|
printnb(i + " ");
|
|
|
|
|
print();
|
|
|
|
|
for(int i : range(5, 20, 3)) // 5..20 step 3
|
|
|
|
|
printnb(i + " ");
|
|
|
|
|
print();
|
|
|
|
|
}
|
|
|
|
|
} /* Output:
|
|
|
|
|
0 1 2 3 4 5 6 7 8 9
|
|
|
|
|
5 6 7 8 9
|
|
|
|
|
5 8 11 14 17
|
|
|
|
|
*///:~
|