goto

grauzone none at example.net
Thu Feb 5 23:28:42 PST 2009


I'd prefer to have some kind of goto, which enforces structured 
programming. Something like:

double euclideanDistance(Range)(Range a, Range b, double limit)
{
     limit *= limit;
     double result = 0;
     foo: {
         for (; !a.empty; a.next, b.next)
         {
             enforce(!b.empty);
             auto t = a.head - b.head;
             result += t * t;
             if (result >= limit) break foo;
         }
         enforce(b.empty);
     }
     return sqrt(result);
}



More information about the Digitalmars-d mailing list