# 操作员 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

### 为空

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

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

### 不为null

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

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

### 为空

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

<expression>必须为列表。 结果是布尔值。

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

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

### ==

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

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

### ！=

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

``````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
``````

## 算术 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

### 是数字

``````<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