If you want to execute some code when the scope is exited, you can use the following handy ON_SCOPE_EXIT macro, like this:

int32 AnyFunction()
{
    ON_SCOPE_EXIT
    {
        // This code will be executed when the scope is exited (after the return statement)
    };

    // Do smth
    
    // Just return 100 for example
    return 100;
}