f[x_] := x^2

f[24]

f[a+b-2]

x_ (*one expression,named x*) 
_Integer (*one integer*) 
x_Integer (*one integer,named x*) 
x__ (*one or more expressions*) 
x___ (*zero or more expressions*) 
x_?test (*expression x for which test[x] is True*) 
x_/;condition (*expression x subject to a condition*)

f[x_Integer, y_Integer] := x^2 + y^2

f[2,3]

f[5, 6]

x^2+2 x+1/. x->(y + z)

x^2+2 x+1/. x->10

rules={x_+0->x,0+x_->x,x_*1->x,1*x_->x,x_*0->0,0*x_->0};

expr=1*(a+0)+0*b;

expr//.rules

(*Does the list contain two equal ADJACENT elements?*)MatchQ[{1,2, 3, 4,4,5, 6},{___,x_,x_,___}]

{4,1,3,5,2, 9, 7}//.{a___,x_,y_,b___}/;y<x:>{a,y,x,b}