On Saturday, 8 August 2015 at 18:28:25 UTC, Binarydepth wrote:
This is the new code :

        foreach(num; 0..liEle)  {//Data input loop

                write("Input the element : ", num+1, " ");
                readf(" %d", &liaOrig[num]);
        }

Even better :

foreach(num; 0..liaOrig.length

I believe they usually do something like:

foreach( num, ref elem; liaOrig){

}

which creates the index num and the reference to the element of range liaOrig.

It also seems that a lot of discussion is going on about reducing use of foreach loops in their preferred style, so you might want to try some of that.


Reply via email to