evosoft interview question

How would you refactor this piece of code?