Motion with Actionscript

Hi, I am pretty new to AC, I just happened to open up Flash a few days ago and searched for AC and loved how it works but I am having some trouble with it. I’m gonna try to start at the basic animations, last night I tried to make a bouncing ball that went from Y:50 - X:50 all the way down to the screen and when it reaches Y:350 (I was using the ruler & grid lol) I wanted it to make it bounce back up slowy at the same speed.
For this then I used:

on (load) {
this._x = 50;
this._y = 50;
}

onClipEvent (enterFrame) {
if (this._y<300) {
this._y += 10;
this._x +=5;
}

This worked, but the ball only went down as I have no clue how code it to make it bounce back! I tried another following IF statement but it didn’t work. Appreciate any help thanks alot!