Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • D

Idiom #94 Print the type of a variable

Print the name of the type of x. Explain if it is a static type or dynamic type.

This may not make sense in all languages.

import std.stdio: writeln;
writeln(typeid(x));

Prints the static type of x.
(type x)

New implementation...
< >
programming-idioms.org