Understanding switch + foreach

Steven Schveighoffer schveiguy at yahoo.com
Thu Apr 17 07:51:47 PDT 2014


On Thu, 17 Apr 2014 10:26:01 -0400, Timon Gehr <timon.gehr at gmx.ch> wrote:

> On 04/17/2014 03:15 PM, Steven Schveighoffer wrote:
>> If the break breaks the foreach, why isn't just case 1 produced? That
>> would be an actual break in the foreach, no?
>>
>
> No. You don't know the dynamic behaviour of the code at runtime just by  
> unrolling the foreach body.
>

I guess that makes sense. Even though the foreach must be unrolled at  
compile time, the actual code is executed at runtime.

Thanks.

-Steve


More information about the Digitalmars-d-learn mailing list