one line function conditional assignment