delay dx #new dx and dy are no longer parameters dy #new while true#new exit loop at return statement center shape getcenter( center getx( center gety(isinside true if xhighdx -dx isinside false if yhighdy -dy isinside false if isinsidept win checkmouse(if pt !none#new dealing with mouse click now here if pt gety(stopheightswitch direction (dxdygetshift(centerpt(dxdy(dx*scaledy*scaleelse#new exit from depths of the loop return #new shape move(dxdytime sleep(delayrecall that return statement immediately terminates function execution in this case the function returns no valuebut bare return is legal to force the exit since the testing is not done in the normal while conditionthe while condition is set as permanently true this is not the most common while loop patternit obscures the loop exit the choice between the approach of bounce py and bounce py is matter of taste in the given situation arbitrary types treated as boolean the following section would merely be an advanced topicexcept for the fact that many common mistakes have their meaning changed and obscured by the boolean syntax discussed you have seen how many kinds of objects can be converted to other types any object can be converted to boolean (type boolread the examples shown in this shell sequencebool( true bool(- true bool( false bool( false bool(nonefalse bool(''false bool(' 'true bool('false'true bool([]false more on flow of control