枚举优化ifelse