Let
\[f(x) = \left\{
\begin{array}{cl}
2x & \text{if $0 \le x < 2$}, \\
8 - 2x & \text{if $2 \le x \le 4$}.
\end{array}
\right.\]Find the maximum value of the function.
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
Let
\[f(x) = \left\{
\begin{array}{cl}
2x & \text{if $0 \le x < 2$}, \\
8 - 2x & \text{if $2 \le x \le 4$}.
\end{array}
\right.\]Find the maximum value of the function.
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
4
Let
\[f(x) = \left\{
\begin{array}{cl}
2x & \text{if $0 \le x < 2$}, \\
8 - 2x & \text{if $2 \le x \le 4$}.
\end{array}
\right.\]Find the maximum value of the function.
train