Foreach
You are here :

Sub nodes

Recent changes
Site plan
 
 

NOT IMPLEMENTED YET !

Will allow to iterates over Iterable set as in :

 Vector<int> v = new Vector();
 fill(v);
 foreach (int e in v) {
   // do something with e
 }

equivalent to :

 Vector<int> v = new Vector();
 fill(v);
 for (Iterator<int> it = v.iterator(); it.hasMore(); it.next())
 {
   int e = it.value();
   // do something with e
 }

That means it will be available in all types implementing the Iterable interface.

 interface Iterable<T> {
   Iterator<T> iterator() const;
   Iterator<T> iterator();
 }
 interface Iterator<T> {
   bool hasMore() const;
   sub next();
   T value() const;
 }

One day we will perhaps have a way to define set of values as in (no syntax defined yet) :

 define byte [0..255]; // a byte is defined between 0 and 255

It is likely those subset will be iterable as well ...

 foreach int i in byte {
 }

NOT IMPLEMENTED YET !

Propulsed by Wiclear