조건 조합

규칙의 if 파트에서 여러 조건을 결합합니다.

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

다음 문장에는 하나의 조건이 포함됩니다.

if the customer category is Gold

다음 문장에서 논리 연산자 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 age of 'the customer' is more than 60 
	or the age of 'the customer' is less 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	the age of 'the customer' is more than 60 
	or (the age of 'the customer' is less than 21 and the category of 'the customer' is Student) 

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

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

if	(the age of 'the customer' is more than 60 or the age of 'the customer' is less 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
		- there is at least one member in the members of 'the Gold team'
 then
	print "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 waiting duration of 'the customer' in minutes is more than 5  
then
	print "redirect the call to a member of the Gold team";