Adjacent item in a array

Vino vino.bheeman at hotmail.com
Sat Feb 3 19:22:11 UTC 2018


On Saturday, 3 February 2018 at 19:19:00 UTC, Adam D. Ruppe wrote:
> On Saturday, 3 February 2018 at 19:13:05 UTC, Vino wrote:
>>  Request you help on printing an array in below,
>
> Try looping through the array printing the current item 
> followed by the item after the current item. Foreach with index 
> may be helpful. Consider what happens on the last element.

Hi Ruppe,

  I have tired it , it prints as expected but getting range 
violation when it reaches the last element

foreach(j, k; D1[].enumerate(1))
     writeln(k,D1[j]);

From,
Vino.B


More information about the Digitalmars-d-learn mailing list