I think you are looking for clause guard, this refactoring method or way is if the function fails, or get the answer at any point, make the return earlier posible.
If you make a lot of if/else block you can have a lot of indentation an unefficient code to read.