a = 1

Clear[f];
f[x_] := 
      Module[
{a, 
          b}, 

a = x!; 
b = Mod[x, 2]; 
a + 
          b
]

f[1]

f[2]

a

b

f[3]

f[1/2]

Head[2]

Head[1/2]

Head[3.1]

Clear[f];
f[x_Integer] := 
        Module[
{a, 
            b}, 

a = x!; 
b = Mod[x, 2]; 
a + 
            b
];

f[x_] := "no integer"

f[1]

f[1/2]

f[-1]

Clear[f];
f[x_Integer?Positive] := 
        Module[
{a, 
            b}, 

a = x!; 
b = Mod[x, 2]; 
a + 
            b
];
f[x_Integer] := "no positive integer"
f[x_] := "no integer"

f[1]

f[-1]

f[π]

Clear[f]
f[x_Integer?(# > 0 &)] := 
      Module[
{a, 
          b}, 

a = x!; 
b = Mod[x, 2]; 
a + 
          b
]

f[1]

f[0]