function that checks type of variable