Skip to content

Commit

Permalink
Replace while with foreach
Browse files Browse the repository at this point in the history
  • Loading branch information
Marenz committed Sep 18, 2016
1 parent 7a84952 commit 3cdd2f9
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -403,18 +403,9 @@ auto outer ( Vector a, Vector b )
{
auto result = slice!double(a.length, b.length);

size_t idx_a, idx_b;

while (idx_a < a.length)
{
while (idx_b < b.length)
{
foreach (immutable idx_a; 0..a.length)
foreach (immutable idx_b; 0..b.length)
result[idx_a, idx_b] = a[idx_a] * b[idx_b];
idx_b++;
}
idx_a++;
idx_b=0;
}

return result;
}
Expand Down

0 comments on commit 3cdd2f9

Please sign in to comment.