[OT] Converting booleans to numbers
Steven Schveighoffer
schveiguy at yahoo.com
Thu Sep 21 15:48:34 UTC 2017
On 9/21/17 11:06 AM, Timon Gehr wrote:
>>> foreach(i; 0 .. 4){
>>> dfs(a + (i==0) - (i==1),
>>> b + (i==2) - (i==3));
>>> }
...
> So am I, but I wasn't commenting on trade-offs, only the view that there
> are no good uses.
This seems way easier for me to grok, and is how I would write it.
dfs(a + 1, 0); dfs(a - 1, 0);
dfs(0, b + 1); dfs(0, b - 1);
-Steve
More information about the Digitalmars-d-learn
mailing list