On 07/09/13 00:57, JS wrote:
> On Monday, 8 July 2013 at 12:11:36 UTC, Dicebot wrote:
>> On Monday, 8 July 2013 at 12:08:44 UTC, JS wrote:
>>> the issue with the foreach is still under question though, when I try to 
>>> use a for loop with i and access TT[i] I get an error about i not being 
>>> compile time readable. (maybe this is because of how the type tuple is 
>>> defined? possibly need a index method to get the value?)
>>
>> Because i is not a compile-time value, it is a normal variable. And TT is a 
>> type tuple, pure compile-time entity. You really need to study the 
>> documentation on this topic or frustration will continue.
> 
> This has nothing to do with it...
> 
> string name = "Value"~((i==0) ? "" : (to!string(i)));
> i++;
> 
> works, but
> 
> string name = "Value"~((i==0) ? "" : (to!string(i++)));
> 
> but doesn't....
> 
> 
> It is a matter of placement of the increment operation on i that is breaking 
> the code and has nothing to do with your default answer of "you don't know 
> how CTFE's work, read the docs!" and "... it's not a compile-time variable".

What should the following program print?

   void main() {
      import std.stdio;
      auto a = 0;
      a==0 ? writeln("Hello") : writeln("world!");
   }

artur

Reply via email to