In D, we use traits
to get internal compiler information, which helps us use functions and variables differently and makes it more beneficial for programming.
writeln(__traits(isFloating, float));
__traits
to call the traits functionality. After that, we use isFloating
to check if the argument is a float
type. It returns true
or false
.import std.stdio;void main() {int i;float t;// Used the traitswriteln(__traits(isFloating, i));writeln(__traits(isFloating, t));}
traits
method in which we use isFloating
as the keyword. It identifies if the passed parameter is of the float
type. It returns the result as true
if the value is float
. Otherwise, it returns false
.Free Resources