Hacker News new | ask | show | jobs
by salmo 2240 days ago
The practice is pretty common and a good reflex to have. In your version there would be a risk of a race condition if it was possible for the environment to change between the calls.

Now, it’s not really an issue here with environment variables. But in general, doing assignment and then walking through the cases is safer.