simplify conditional assignment