what you need to do (if you are wanting the ball to move to the top, bounce and move all the way to the bottom, bounce move to the top, etc) is set up a direction variable(i usually use a bool) that will change when the ball reaches the edge of the screen. something like this:
bool up=true;
if (up)
{
y-=1;
if (y<TOP) up=false;
}
else
{
y+=1:
if (y>BOTTOM) up=true;
}
this will make it so that the ball bounces off the top and bottom. But really, this could be simplified even more if you are using a variable to move the ball:
y+=VELOCITY;
if (y<TOP || y>BOTTOM) VELOCITY=-VELOCITY;
at least, this is what I usually do when I want to bounce things off walls.
I am not smart. I am not powerful. I am just a guy. I am strengthened through my faith.