# `power`

## Description

Returns the result of raising a number to the power of an exponent.

## Syntax

Like many functions in DataPrime, `power` supports [two notations](https://coralogix.com/docs/dataprime/language-reference/functions-reference/index.md), **function** and **method** notation. These interchangeable forms allow flexibility in how you structure expressions.

```dataprime
power(number: number, exponent: number): number
```

```dataprime
(number: number).power(exponent: number): number
```

## Arguments

| Name     | Type   | Required | Description                                                   |
| -------- | ------ | -------- | ------------------------------------------------------------- |
| number   | number | **true** | The base value to raise                                       |
| exponent | number | **true** | The exponent to raise the base to (e.g. `2` squares the base) |

## Example

**Use case: Square a number**

Raise a numeric field to the power of 2 to calculate its square.

### Example data

```json
{
    "num": 7
}
```

### Example query

```dataprime
create num_squared from power(num, 2)
```

```dataprime
create num_squared from num.power(2)
```

### Example output

```json
  {
      "num": 7,
      "num_squared": 49
  }
```
