Oscillating between two values

Ok, this is a really basic question that I keep forgetting the proper answer to.

If, say for example, I want a ball to scale from 10 pixels to 300 pixels, and when it reaches 300, scale back down to 10. When it reaches 10, scale up again.

If I simply tell the ball that when it is at or below ten, scale up, or at or above 300, scale up, this presents the obvious problem of gutters. It will get stuck in either gutter, and either jit, or not move.

Anybody offer up the right way or common pratice to do this sort of thing?

Thanks in advance for any help.

:puzzled: