set value outside if/else block