f[x_]:=2x^2

f[1,3]

f[x_,y_]:=x+y

f[1,3]

{
f[2,2],
f[2,{2}],
f[Pi,{1,2}],
f[{Pi},{1,2}],
f[Pi,f[1,2]],
f[Pi,f[{1,2}]],
f[{1,2},{1,2}],
f[Pi,E,1,2]
}//ColumnForm

a+{1,2,3,4,a,b,c,d}

f[x_,x_]:={x}

{
f[2,2],
f[2,{2}],
f[Pi,{1,2}],
f[{Pi},{1,2}],
f[Pi,f[1,2]],
f[Pi,f[{1,2}]],
f[{1,2},{1,2}],
f[Pi,E,1,2]
}//ColumnForm

?f

f[z_,{1,2}]:=
{Pi,E}[[Random[Integer]+1]]

{
f[2,2],
f[2,{2}],
f[Pi,{1,2}],
f[{Pi},{1,2}],
f[Pi,f[1,2]],
f[Pi,f[{1,2}]],
f[{1,2},{1,2}],
f[Pi,E,1,2]
}//ColumnForm

?f

Clear[f]

?f

f[x_,2 x_]:=Pi

f[x_,Times[2,x_]]:=Pi

{
f[E,2 E],
f[2, 2 2],
f[2.,2. 2.],
f[z, 2 z],
f[Sin[1],2 Sin[1]]
}//ColumnForm

Clear[f]

f[x_,y_/;2x==y]:=Pi

{
f[E,2 E],
f[2, 2 2],
f[2.,2. 2.],
f[z, 2 z],
f[Sin[1],2 Sin[1]]
}//ColumnForm

f[x_,y_]/;2x==y:=Pi

{
f[E,2 E],
f[2, 2 2],
f[2.,2. 2.],
f[z, 2 z],
f[Sin[1],2 Sin[1]]
}//ColumnForm

Clear[f]

f[{x_}]:=-1

{
f[{}],
f[1],
f[{1}],
f[{1,1}],
f[{{1,1}}],
f[{1},{1}],
f[f[{1}]]
}//ColumnForm

g[t_]
g[1,2]

h[{args__}]:=Length[{args}]

{
h[{}],
h[1],
h[{1}],
h[{1,1}],
h[{{1,1}}],
h[{1},{1}],
h[f[{1}]]
}//ColumnForm

Clear[f]

f[x_]:=x

f[x_,y_]:=x+y

f[x_,y_,z_]:= x y z

f[w__]:=Length[{w}]

?f

{
f[],
f[Pi],
f[Sin[1],Cos[1]],
f[x,y,z],
f[1,2,3,4,5,6,7,8,9]
}//ColumnForm

f[t___]:="empty list"

{
f[],
f[Pi],
f[Sin[1],Cos[1]],
f[x,y,z],
f[1,2,3,4,5,6,7,8,9]
}//ColumnForm

Clear[h]

h[x_,y_]:={y,x}

h[args__]:=Reverse[{args}]

{
h[1,2,3],
h[{1},{2},{3},{4,5,6}],
h[{}],
h[],
h[{a,b,c}]
}//ColumnForm

Clear[f]

How do return the second argument?

f[whatever__]:={whatever}[[2]]

f[x,y,z,1,2,3]

f[2]

Clear[f]

f[args__]/;Length[{args}]≥2:={args}[[2]]

f[1]

How do return the second argument?

Clear[f]

f[first_,second__]:={second}[[1]]

f[first_,second__]:=First[{second}]

f[first_,second_,whatever___]:=second

f[_,second_,___]:=second

How do return the penultimate (second last) argument?

hh[args__]:={args}[[-2]]

hh[a,b,c,1,2,3]

Clear[hh]

hh[___,l_,_]:=l

Clear[f]

f[{l___,x_,y_,r___}]/;x>y:=f[{l,y,x,r}]

f[x_]:=x

f[{3,2,1,2,3,-3,-2,-1}]