**= Power assignment
Last updated: 2026-09-22
**= Power assignment
**= raises the left variable to the power of the right value, equivalent to x = x ** y.
| Category | Operators |
|---|---|
| Kind | Operator |
📝 Syntax
x **= y
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
8
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QAre x **= 3 and x = x ** 3 the same?
AEquivalent. With `x = 2; x **= 3`, `x == 8`. Note that `**` is right-associative, so `x **= y` behaves as `x = x ** y` with no associativity ambiguity.
QIs x **= 0.5 a square root?
AYes. With `x = 9; x **= 0.5`, `x == 3.0` (a float). If `x` is negative, a fractional exponent returns a complex result.
QWhat about x **= with a negative power?
AYou get the reciprocal: with `x = 2; x **= -1`, `x == 0.5`. A negative base with a negative integer exponent is also valid, e.g. `x = -2; x **= -1` gives `-0.5`.