Solidity REPL
Math & units

Compound assignment

Update one integer with arithmetic and shift assignment operators.

Solidity 0.8.36REPL mode

Why use this example

Use this pattern to confirm Solidity arithmetic and unit behavior before putting the same expression into a contract. The entry isolates compound assignment so its input, result, and state changes stay easy to compare.

Solidity to run

uint256 value = 10
value += 5
value *= 2
value >>= 1
value

Official Solidity reference

Compare this focused investigation with the complete language definition in the Solidity documentation.

Assignment operators

What to expect

The assignment sequence adds five, doubles the result, shifts it right once, and leaves the final value at 15.

Continue the investigation

Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.

Read about writing Solidity Prototype Solidity behavior