| if(condition, result_if_true, result_if_false)
 | condition을 평가하고 조건이 참으로 평가되면result_if_true를 반환하고 조건이false로 평가되면result_if_false를 반환합니다.
 condition은 숫자여야 합니다. 이 함수는0및 빈 문자열을false로 간주하고 그 밖의 모든 것(NaN포함)을true로 간주합니다. 부울은0(거짓)와1(참)로 변환됩니다.
 이 함수에서 none 상수를 반환하여 특정 조건에 대한 출력값을 무시할 수 있습니다. 즉, 조건을 충족하지 않는 데이터 포인트를 필터링할 수 있습니다. 자세한 내용은 데이터 포인트 필터링 단원을 참조하십시오. 예시
                       
                       
                       
                       
                    
                        if(0, x, y)에서는 변수y를 반환합니다.
                        if(5, x, y)에서는 변수x를 반환합니다.
                        if(gt(temp, 300), x, y)에서는 변수temp가300보다 크면 변수x를 반환합니다.
                        if(gt(temp, 300), temp, none)에서는300보다 크거나 같으면 변수temp를 반환하고,temp가300보다 작으면none(값 없음)을 반환합니다.
하나 이상의 인수가 조건 함수인 중첩 조건 함수에는 UFCS를 사용하는 것이 좋습니다. if(condition, result_if_true)를 사용하여 조건을 평가하고elif(condition, result_if_true, result_if_false)를 사용하여 추가 조건을 평가할 수 있습니다. 예를 들어, if(condition1, result1_if_true,
                      if(condition2, result2_if_true, result2_if_false))대신if(condition1,
                      result1_if_true).elif(condition2, result2_if_true,
                      result2_if_false)를 사용할 수 있습니다. 중간 조건 함수를 추가로 연결할 수도 있습니다. 예를 들어, if(condition1, result1_if_true).elif(condition2,
                      result2_if_true).elif(condition3, result3_if_true,
                      result3_if_false)와 같이 여러if문을 중첩하는 대신if(condition1, result1_if_true, if(condition2,
                      result2_if_true, if(condition3, result3_if_true
                    result3_if_false)))를 사용할 수 있습니다. UFCS와 함께 elif(condition, result_if_true,
                        result_if_false)를 사용해야 합니다. |