That depends (as always). The difference is, yours is "better" because it just does more. It makes sure to only do something if the environment variable has a proper value. If you "feel" you'd have to do something if the value is incorrect, like emitting a warning or an error, the if version is great. If you have built or validated your string beforehand, or got it out of a data store where only valid strings are, you can just use the assignment. If you're not sure that you'll remember what it does (because you're not using it very often, for example) just add a comment that explains it. When in doubt, I'd recommend your version though.
hth, p
Ordinary morality is for ordinary people. -- Aleister Crowley