Re: How do you iterate "vertically" over a 2-D array?

2018-10-09 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 9 October 2018 at 10:52:47 UTC, Chris Katko wrote: I have a 2-D array: int[5][5] data = [ [1, 0, 1, 0, 0], [1, 0, 1, 0, 0], [1, 0, 1, 1, 1], [1, 0, 0, 1, 0], [1, 1, 1, 1, 0] ]; 1 - Is

Re: How do you iterate "vertically" over a 2-D array?

2018-10-09 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 9 October 2018 at 10:52:47 UTC, Chris Katko wrote: I have a 2-D array: 1 - Is there a way to foreach vertically through that? (that is, rotated 90 degrees from the usual iteration.) 2 - Is there a way to send that "vertical slice" to a function? Not built-in in the language,

Re: How do you iterate "vertically" over a 2-D array?

2018-10-09 Thread Chris Katko via Digitalmars-d-learn
On Tuesday, 9 October 2018 at 10:52:47 UTC, Chris Katko wrote: I have a 2-D array: int[5][5] data = [ [1, 0, 1, 0, 0], [1, 0, 1, 0, 0], [1, 0, 1, 1, 1], [1, 0, 0, 1, 0], [1, 1, 1, 1, 0] ]; 1 - Is

How do you iterate "vertically" over a 2-D array?

2018-10-09 Thread Chris Katko via Digitalmars-d-learn
I have a 2-D array: int[5][5] data = [ [1, 0, 1, 0, 0], [1, 0, 1, 0, 0], [1, 0, 1, 1, 1], [1, 0, 0, 1, 0], [1, 1, 1, 1, 0] ]; 1 - Is there a way to foreach vertically through that? (that is,