How to get the type of an object

Example:

list = {1, 2, 3};
integer = 1;
real = 0.1;

Head @ list
Head @ integer
Head @ real

Output:

List

Integer

Real

Reference

Head


(Post adapted after comments.)

Mathematica 10 introduced a new type system local to Dataset, that's used like this:

Needs["TypeSystem`"]
DeduceType[{1, Sqrt[2], "test", {1, Sqrt[2], 3}, {1, 2, 3}}]

Mathematica graphics

In this type system a type is not the same as Head[expr]. In this framework the head of an atomic value is instead retrieved by TypeAtoms:

Mathematica graphics

But yes, for what you want to do you still need Head.

Tags:

Data Types