How does the volume of a gas change if the gas is doing work on the environment? If the environment is doing work on the gas?
To figure this out, you'll need to go back to the definition of work. Work is best definite in a one-directional sense as the integral over a distance of the force applied. More simply,
W = F*d
where W=work, F=force, and d=distance.
In thermodynamics, we often see the term P*Delta(V) to represent work (not always, but most of the time in most chem classes). If you think about it, that would be roughly the same thing as force*distance.
Now, how to apply it to this problem. In order for the environment to do work on a gas, it must "push" the gas back in on itself. In other words, the external environmnet is pushing the particles in the gas by a certain force over a certain distance into a smaller volume. Therefore, when the environment is doing work on a gas, the gas is decreasing in volume.
The opposite holds if we say the gas is doing work on the environment. The gas is "pushing" outward on the environment over a certain distance away from its initial volume. This would indicate that the volume of gas is increasing because the gas is expanding.
I hope that helps!