# 操作者

``````    // left-hand unary operators
<operator> <operand> // operand is an expression

// right-hand unary operators
<operand> <operator> // operand is an expression
@{LobbyBeacon.endUserIDs._experience.emailid.id} is not null

// binary operators
<operand1> <operator> <operand2>
``````

## 重要備註

• 使用乘法時(`*`)，兩個操作欄位必須具有相同的類型（整數或小數）。 範例 :
• 以下示例正確： `3.0 * 4.0`
• `3 * 4.0` 將導致錯誤

## 邏輯

### 和

``````<expression1> and <expression2>
``````

``````3.14 > 2 and 3.15 < 1
``````

### 或

``````<expression1> or <expression2>
``````

``````3.14 > 2 or 3.15 < 1
``````

### 不

``````not <expression>
``````

<expression> 必須是布爾型。 結果為布爾型。

``````not 3.15 < 1
``````

## 比較

### 空

``````<expression> is null
``````

``````@{BarBeacon.location} is null
``````

### 不為空

``````<expression> is not null
``````

``````@ is not null
``````

### 空

``````<expression> has null
``````

<expression> 必須是清單。 結果為布爾型。

``````["foo", "bar", null] has null --  returns true.
``````
``````["foo", "bar", ""] has null -- returns false because "" is not considered as null.
``````

### ==

``````<expression1> == <expression2>
``````

``````3.14 == 42
``````
``````"foo" == "bar"
``````

### !=

``````<expression1> != <expression2>
``````

``````3.14 != 42
``````
``````"foo" != "bar"
``````

### >

``````<expression1> > <expression2>
``````

``````3.14 > 42
``````

### >=

``````<expression1> >= <expression2>
``````

``````42 >= 3.14
``````

### <

``````<expression1> < <expression2>
``````

``````42 < 3.14
``````

### <=

``````<expression1> <= <expression2>
``````

``````42 <= 3.14
``````

## 算術

### +

``````<expression1> + <expression2>
``````

``````1 + 2 -- returns 3
``````

### -

``````<expression1> - <expression2>
``````

``````2 - 1 -- returns 1
``````

### /

``````<expression1> / <expression2>
``````

<expression2> 不能等於0（返回0）。

``````4 / 2 -- returns 2
``````

### *

``````<expression1> * <expression2>
``````

``````3 * 4 -- returns 12
``````

### %

``````<expression1> % <expression2>
``````

``````3 % 2 -- returns 1.
``````

## Math

### 是數字

``````<expression> is numeric
``````

``````@ is numeric
``````

### 整數

``````<expression> is integer
``````

``````@ is integer
``````

### 小數

``````<expression> is decimal
``````

``````@ is decimal
``````

## 字串

### +

``````<string> + <expression>
``````
``````<expression> + <string>
``````

``````"the current time is " + (now()) -- returns "the current time is 2019-09-23T09:30:06.693Z"
``````
``````(now()) + " is the current time" -- returns "2019-09-23T09:30:06.693Z is the current time"
``````
``````"a" + "b" + "c" + 1234 -- returns "abc1234".
``````

## 日期

### +

``````<expression> + <duration>
``````

``````toDateTime("2011-12-03T15:15:30Z") + toDuration("PT15M") -- returns 2011-12-03T15:30:30Z
``````
``````toDateTimeOnly("2011-12-03T15:15:30") + toDuration("PT15M") -- returns 2011-12-03T15:30:30
``````
``````now() + toDuration("PT1H") -- returns a dateTime (with UTC time zone) one hour later from current time
``````
``````toDuration("PT1H") + toDuration("PT1H") -- returns  PT2H
``````