(*Recorsion*)
f[x_] := 
        Module[{f, t = x}, 
          f[t_] := t /; 0 ≤ t < 1
; 
          f[t_] := 2 - t /; 1 ≤ t < 2
; 
          f[t_] := f[t - 2] /; t ≥ 2
; 
          f[t_] := f[t + 2] /; t < 0; f[t]]

f[1]

f[10]

Plot[f[s], {s, -3, 10}]

g[x_] := 
      Module[{f, t = x, h}, Label[begin]; 
        If[0 ≤ t < 1, 
          f[t_] := t, (If[1 ≤ t < 2, 
              f[t_] := 2 - t, (If[t < 0, t = t + 2; 
                  Goto[begin], 
(If[t ≥ 2, 
                      t = t - 2; 
                      Goto[begin]]
)]
)]
)]; f[t]
]

g[1]

g[10]

g[2.5]

Plot[g[s], {s, -3, 10}]