adaptive if else