Question: Determine numelems for an unassigned variable

Suppose I have a table of variables

 

f[1]:=a;

f[2]:=b;

 

numelems(f); gives 2.

 

In case I have not assign f, 

unassign(f);
numelems(f); gives error message.

 

Is there any simple way let maple detect that if it is unassined, numelems(f), can provide zero?

 

Thank you very much

 

Please Wait...