How to test for success on try statement

I would like to perform a certain action in case a try statement returns success. Is there a way?

try --test for valid internet
    do shell script "ping -o -t 2 1.1.1.1"
    --would like to do something here only if above line returns success
on error
    beep
end try

try
    x
    y
on error
    z
end try

If x errors, z executes.
If x succeeds, y executes. Therefore, add your desired code at position y.