# What is the effect of using Revert in Sway?

**URL:** https://forum.fuel.network/t/what-is-the-effect-of-using-revert-in-sway/1865
**Category:** Sway
**Tags:** faqs
**Created:** [February 21, 2023, 4:58am UTC](https://forum.fuel.network/t/what-is-the-effect-of-using-revert-in-sway/1865 "2023-02-21T04:58:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![VeeEm](https://avatars.discourse-cdn.com/v4/letter/v/a183cd/32.png) [@VeeEm](https://forum.fuel.network/u/VeeEm)
#### Post date: [February 21, 2023, 4:58am UTC](https://forum.fuel.network/t/what-is-the-effect-of-using-revert-in-sway/1865/1 "2023-02-21T04:58:12Z")

</div>

Is there a reference that describes the usage of Revert and what it does in Sway?

---

<div class="post-metadata">

### Author: ![VeeEm](https://avatars.discourse-cdn.com/v4/letter/v/a183cd/32.png) [@VeeEm](https://forum.fuel.network/u/VeeEm)
#### Post date: [February 21, 2023, 5:19am UTC](https://forum.fuel.network/t/what-is-the-effect-of-using-revert-in-sway/1865/2 "2023-02-21T05:19:18Z")

</div>

The effect of using `Revert` in Sway is described in the Fuel specification [here](https://github.com/FuelLabs/fuel-specs/blob/master/src/vm/instruction_set.md#rvrt-revert). Whenever `revert()` operation is used in your smart contract, it halts execution and reverts back the state changes.

---

<div class="post-metadata">

### Author: ![furnic](https://avatars.discourse-cdn.com/v4/letter/f/97f17d/32.png) [@furnic](https://forum.fuel.network/u/furnic)
#### Post date: [February 21, 2023, 1:13pm UTC](https://forum.fuel.network/t/what-is-the-effect-of-using-revert-in-sway/1865/3 "2023-02-21T13:13:33Z")

</div>

I’ll just add that this goes for chains of contract calls as well, for example:  
I call `ContractA`, which updates storage, transfers some tokens somewhere, and then calls `ContractB`, updating its storage and then finally calling `ContractC`. If the code execution in `ContractC` hits a `revert`, the whole chain of calls and effects is undone.

The entire transaction is atomic , meaning that if any part of it fails, the entire thing fails and reverts back to how things were before the attempted transaction.  
There is only one effect that is persistent after a `revert`: Any gas spent trying to execute the above TX is spent & gone 🙂
