如果所有变量都相等,我尝试做一个脚本来设置一个变量(例如set matchornotmatch匹配)。
set value1 to "FR"
set value2 to "FR"
set value3 to "FR"
set value4 to "FR"
set matchornotmatch to "no match"
if value1 is equal to (value2 is equal to (value3 is equal to value4)) then
set matchornomatch to "MATCH"
end if
如果不返回value1 = value2 = value3但不等于value4(如果可能的话)
答案 0 :(得分:2)
一系列If,else if,else语句应该可以解决这个问题:
set value1 to "FR"
set value2 to "FR"
set value3 to "FR"
set value4 to "FR"
set matchornotmatch to ""
if (value1 = value2) and (value1 = value3) then
if (value1 = value4) then
set matchornotmatch to "MATCH"
else
set matchornotmatch to "partial match"
end if
else
set matchornotmatch to "no match"
end if
return matchornotmatch