I think it's better style to do assignment outside of the if statement - you don't normally expect function calls to have side effects, so when skimming code, it makes it harder to see when variables are created.