조건 조합

조건을 그룹에 적용하고 중첩된 그룹을 테스트할 수 있습니다.

논리 연산자를 사용하여 규칙의 if 파트에서 조건을 결합할 수 있습니다.

다음 if 명령문에 하나의 조건이 포함되어 있습니다.

if the customer category is Gold

다음 if 명령문에서 논리 연산자 and는 두 개의 조건을 링크합니다.

if the category of the customer is Gold and the customer has been waiting longer than 5 minutes 

or에 대한 and의 우선순위

논리 연산자 and 및 or가 규칙의 if 파트에서 조건을 링크하면 and 연산자가 or 연산자보다 우선순위를 갖습니다.

다음 if 명령문을 살펴보십시오.

if
	the customer is older than 60
	or the customer is younger than 21
	and the category of the customer is Student 

다음 조건 중 하나가 true인 경우 명령문이 true입니다.

  • The customer is older than 60
  • The customer is younger than 21 and a student

다중 조건 및 소괄호

논리 연산자의 우선순위를 명확히 하기 위해 소괄호를 사용할 수 있습니다.

다음 if 명령문에서, 소괄호가 카테고리로 나이 한계를 그룹화합니다.

if
	the customer is older than 60
	or (the customer is younger than 21 and the category of the customer is Student) 

또한 소괄호를 사용하여 조건의 해석을 변경할 수 있습니다.

다음 if 명령문에서, 고객이 60세가 넘거나 21세 미만인 학생인 경우 소괄호의 조건이 충족됩니다.

if
	(the customer is older than 60 or the customer is younger than 21)
	and the category of the customer is Student

동일한 논리 연산자를 사용하는 다중 조건

조건을 그룹화하고 다음 명령문을 사용하여 그룹의 모든 조건에 동일한 논리 연산자를 적용할 수 있습니다.

  • all of the following conditions are true: 이 비즈니스 용어는 논리 연산자 and를 사용하여 그룹에서 모든 조건을 링크합니다.
  • any of the following conditions is true: 이 비즈니스 용어는 논리 연산자 or를 사용하여 그룹에서 모든 조건을 링크합니다.

다음 규칙에서는 조건이 둘 다 true인 경우에만 조치가 수행됩니다.

if
	all of the following conditions are true:
		- the category of the customer is Gold
		- a member of the Gold team is available
then
	redirect the call to a member of the Gold team; 

다음 예제에서는 고객의 카테고리가 골드이거나 고객이 5분 이상 대기한 경우에 조치가 수행됩니다.

if
	any of the following conditions is true:
		- the category of the customer is Gold
		- the customer has been waiting longer than 5 minutes
then
	redirect the call to a member of the Gold team;