a quicker implementation:

if (action == 'decrease') {
step *= -1;
}

val += step;