Simply evaluating a boolean variable as you have done here, these are roughly equivalent. However, if the variable were replaced with a complicated expression that took a long time to evaluate, the second example would be better because it would only be evaluated once.