f[x_]  := (x+2) /; (-2 < x < 1)
f[x_]  := (3x) /; (1 <= x < 3)
Plot[f[x], {x, -2, 3}]

Plot[{x+2,3x}, {x, -2, 3}]

f2[x_]  := (x+2) /; (-2 < x < 1)
f2[x_]  := (3x) /; (1 < x < 3)
Plot[f2[x], {x, -2, 3}]

f3[x_]  := (x+3) /; (-2 < x < 1)
f3[x_]  := (3x) /; (1 <= x < 3)
Plot[f3[x], {x, -2, 3}]

D[f3[x],x]

Clear[g1,g2,g3,x]
g1[x_]:=x+3
g2[x_]:=3x
g3[x_]:=Piecewise[{{g1[x],(-2 < x < 1)},{g2[x],(1 <= x < 3)}}]
Plot[g1[x],{x, -2, 3}]
Plot[g2[x],{x, -2, 3}]
Plot[g3[x],{x, -2, 3}]
D[g1[x],x]
D[g2[x],x]
D[g3[x],x]