# Plus

### Description

Adding or concat two values with each other.

### Number|Event + Number|Event

<pre class="language-java"><code class="lang-java">Scalar&#x3C;Number|Event> + Scalar&#x3C;Number|Event> : Scalar&#x3C;Number>
Scalar&#x3C;Number|Event> + GroupedScalar&#x3C;Number|Event> : GroupedScalar&#x3C;Number>
GroupedScalar&#x3C;Number|Event> + Scalar&#x3C;Number|Event> : GroupedScalar&#x3C;Number>
<strong>GroupedScalar&#x3C;Number|Event> + GroupedScalar&#x3C;Number|Event> : GroupedScalar&#x3C;Number>
</strong></code></pre>

Two arguments of type Scalar\<Numbers> added to each other result in a Scalar\<Number> which is the sum of both arguments.

If one argument is a Scalar, and the other one a GroupedScalar, then the operation is performed by taking the Scalar value and the value of each group value, which results another GroupedScalar (it has same group size, as the one from the input argument).

If both arguments are GroupedScalar, then the operation is performed by taking values with same group key, which  results in another Grouped Scalar (the group size is equal or smaller than the ones of the input arguments).

***

### Time + Timespan

```java
Scalar<Time> + Scalar<Timespan> : Scalar<Time>
Scalar<Time> + GroupedScalar<Timespan> : GroupedScalar<Time>
GroupedScalar<Time> + Scalar<Timespan> : GroupedScalar<Time>
GroupedScalar<Time> + GroupedScalar<Timespan> : GroupedScalar<Time>
```

Adding a Scalar\<Time> with a Scalar\<Timespan> results in a Scalar\<Time> which is a point in time after the Scalar\<Time>.

***

### Timespan + Timespan&#x20;

```java
Scalar<Timespan> + Scalar<Timespan> : Scalar<Time>
Scalar<Timespan> + GroupedScalar<Timespan> : GroupedScalar<Time>
GroupedScalar<Timespan> + Scalar<Timespan> : GroupedScalar<Time>
GroupedScalar<Timespan> + GroupedScalar<Timespan> : GroupedScalar<Time>
```

Adding a Scalar\<Timespan> to a Scalar\<Time> results in a Scalar\<Time> which is far more in the future as stated by the Scalar\<Timespan>

***

### Text + any

```java
Scalar<Text> + Scalar<any> : Scalar<Text>
Scalar<Text> + Vector<any> : Scalar<Text>
Scalar<Text> + GroupedScalar<any> : Scalar<Text>
Scalar<Text> + GroupedVector<any> : Scalar<Text>
Vector<Text> + Scalar<any> : Scalar<Text>
Vector<Text> + Vector<any> : Scalar<Text>
Vector<Text> + GroupedScalar<any> : Scalar<Text>
Vector<Text> + GroupedVector<any> : Scalar<Text>
GroupedScalar<Text> + Scalar<any> : Scalar<Text>
GroupedScalar<Text> + Vector<any> : Scalar<Text>
GroupedScalar<Text> + GroupedScalar<any> : Scalar<Text>
GroupedScalar<Text> + GroupedVector<any> : Scalar<Text>
GroupedVector<Text> + Scalar<any> : Scalar<Text>
GroupedVector<Text> + Vector<any> : Scalar<Text>
GroupedVector<Text> + GroupedScalar<any> : Scalar<Text>
GroupedVector<Text> + GroupedVector<any> : Scala
```

Adding a *scalar* or *vector* of type Boolean, Number, Time, Timespan, Text to a *scalar* or *vector* of type Text results in a new Scalar\<Text with concatenated text elements. Non-text elements are implicitly formatted (see [#format-or](#format-or "mention")). Vector elements are joined with commas.

### Examples

Calculating 1 + 2 equals 3

```java
1+2
```

Adding 8 hours to the last full hour results in 13:00 o'clock, when the lastZeroHour was 5:00 o'clock.

```java
lastZeroHour + 8h
```

Adding 30min to 1h results in 1h30m

```java
1h + 30min
```

Concat Text with the result of a function

```java
'Consumption' + SUM($PowerConsumption) + ' W'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.moost.io/platform-manual/rules/rule-language/operations/plus.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
