the if-else can be transformed to a simple assignment.