trigger when out of bounds.

Since I'm making a simple version of pong I change the xvelocity and the yvelocity of the ball to have it move around. How can I set it up so that when the ball's edge (not the center) hits one of the edges of view it will reverse velocity?