Tips for golfing in D2 What general tips do you have for golfing in D? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to D (e.g. "remove comments" is not an answer). Please post one tip per answer.
D is JavaScript.



Obviously not. But, when dealing  with float, double and real, nan is a value which must be handled, and, as specified by IEEE 754, NaN does not compare equal with itself.

writeln(double.nan == double.nan); // false


Meaning,

writeln(value!=value); // only true for nan


is way shorter than

import std.math;
writeln(isNaN(value));


Obviously, always use math.isNaN for real code. ;)