ForEach blocksWhen array definitions get complicated, the ForEach(range) block comes to the rescue. Every variable created within a ForEach(range) block is automatically tagged with .ForEach(range). Thus the ForEach block works very similarly to a foreach loop in C# (except it is treated as a single object by the Infer.NET compiler, with corresponding efficiency gains during compilation). For example, if bools and pixel are defined as in Working with arrays and ranges, then:
is equivalent to:
ForEach blocks can also be nested, to define multi-dimensional arrays. So the following definition:
is equivalent to:
and also equivalent to:
|


