perform if-based condition only once or multiple times?