Programming in D – Solutions

auto and typeof

We can use typeof to determine the type of the literal and .stringof to get the name of that type as string:

import std.stdio;

void main() {
    writeln(typeof(1.2).stringof);
}

The output:

double