# 操作者 operators

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

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

// binary operators
// <operand1> <operator> <operand2>
// operand is an expression
``````

## 重要備註 important-notes

• 使用乘法(`*`)時，兩個作業欄位必須具有相同的型別，可以是整數或小數。 範例：

• 下列範例是正確的： `3.0 * 4.0`
• `3 * 4.0`將導致錯誤

## 邏輯 logical

### 和

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

<expression1>和<expression2>都必須是布林值。 結果是布林值。

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

### 或

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

<expression1>和<expression2>都必須是布林值。 結果是布林值。

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

### 非

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

<expression>必須為布林值。 結果是布林值。

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

## 比較 comparison

### 為null

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

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

### 不是null

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

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

### 具有null

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

<expression>必須是清單。 結果是布林值。

``````["foo", "bar", null] has null
``````

``````["foo", "bar", ""] has null
``````

### ==

``````<expression1> == <expression2>
``````
NOTE
<expression1>和<expression2>沒有資料型別控制項。

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

### ！=

``````<expression1> != <expression2>
``````
NOTE
<expression1>和<expression2>沒有資料型別控制項。

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

### >

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

Datetimeonly可以與Datetimeonly比較。

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

### >=

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

Datetimeonly可以與Datetimeonly比較。

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

### <

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

Datetimeonly可以與Datetimeonly比較。

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

### <=

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

Datetimeonly可以與Datetimeonly比較。

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

## 算術 arithmetic

### +

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

``````1 + 2
``````

### -

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

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

### /

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

<expression2>不可以等於0 （傳回0）。

``````4 / 2
``````

### *

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

``````3 * 4
``````

### %

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

``````3 % 2
``````

## Math math

### 是數值

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

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

### 為整數

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

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

### 為小數

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

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

## 字串 string

### +

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

``````"the current time is " + (now())
``````

``````(now()) + " is the current time"
``````

``````"a" + "b" + "c" + 1234
``````

## 日期 date

### +

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

``````(toDateTime("2023-12-03T15:15:30Z")) + (toDuration("PT15M"))
``````

``````(toDateTimeOnly("2023-12-03T15:15:30")) + (toDuration("PT15M"))
``````

``````(now()) + (toDuration("PT1H"))
``````

``````(toDuration("PT1H")) + (toDuration("PT1H"))
``````

recommendation-more-help
b22c9c5d-9208-48f4-b874-1cefb8df4d76