what the others said, but it is bad practice because holding your breath at depth and then ascending can cause over expansion of your lungs, it is really dangerous, so to prevent that from ever happening you should never hold your breath underwater while on SCUBA. The reason it is dangerous is because the air you are holding in your lungs will expand as you ascend (if you keep holding your breath). The reason you can hold your breath when you are swimming or snorkeling is because you are taking a normal deep breath above water then going to depth which actually decreases the amount of air in your lungs, and when you ascend back up, you already had less air in your lungs to begin with, and even if you somehow didn't lose any air in your lungs that whole time, it would have re-expanded back to the amount you had already taken in...
Hope that made sense.