On Monday, 9 September 2019 at 19:08:17 UTC, WhatMeWorry wrote:
struct FoundationPile { Card[] up; // all cards are face up on the Foundation } FoundationPile[4] foundations; static if(true) { int r = 2; int c = 40; static foreach(i ; foundations) {immutable string brackets = "\033[" ~ to!string(r) ~ ";" ~ to!string(c) ~ "H";c = c + 10; // line 155 } }
NB dont use name "i" for foreach/ranges, foreach can be used with index too, use "el" as "element" or "it" as "iterator" or just "something"
static if(true) { enum r = 2, c = 40; // bad names too static foreach( idx, el; foundations) {immutable string brackets = "\033[" ~ to!string(r) ~ ";" ~ to!string(c + idx*10) ~ "H";} }
