digitalmars.D.learn - Why `i` not working on foreach loop if it have byLine option
- Suliman (4/4) Dec 17 2015 Next code produce error:
- Daniel Kozak via Digitalmars-d-learn (4/11) Dec 17 2015 V Thu, 17 Dec 2015 14:09:57 +0000
- cym13 (3/7) Dec 17 2015 Because byLine doesn't return an array, use std.range.enumerate :
Next code produce error: foreach(i, line;fileContent.byLine) Error: cannot infer argument types, expected 1 argument, not 2 Why it's do not work?
Dec 17 2015
V Thu, 17 Dec 2015 14:09:57 +0000 Suliman via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> napsáno:Next code produce error: foreach(i, line;fileContent.byLine) Error: cannot infer argument types, expected 1 argument, not 2 Why it's do not work?http://dlang.org/phobos/std_range.html#enumerate
Dec 17 2015
On Thursday, 17 December 2015 at 14:09:57 UTC, Suliman wrote:Next code produce error: foreach(i, line;fileContent.byLine) Error: cannot infer argument types, expected 1 argument, not 2 Why it's do not work?Because byLine doesn't return an array, use std.range.enumerate :
Dec 17 2015