Since this is a pieciwise function we need to determine which expression to use for the value of x given. For the definition of the function we notice that for every x grater than 4 we need to use the function:
Since in this case we want to evaluate the function at x=6 and this value is greater that four we need to use this expression.
Then we have that:
Therefore the value of the function at x=6 is -18