# Exit proc (atom)

Source: https://ref.dm-lang.org/atom/proc/Exit

### Format
> `Exit(atom/movable/O, atom/newloc)`

### Returns
> 1 to permit; 0 to deny.

### When
> Called when an object attempts to exit the contents list.

### Args
- `O`: the object attempting to exit.
- `newloc`: the object's new location.


### Default action
> Turfs will call Uncross() and return that value (1 by default). All others allow the object to exit (returning 1).

By default, every atom returns 1 to allow exit, except for turfs which call Uncross() to handle it for them.

> [!note]
> 
> The following behavior only applies to [LEGACY_MOVEMENT_MODE](https://ref.dm-lang.org/world/var/movement_mode.md). In all other movement modes, the turf's contents are not taken into account. Only the result of turf.Uncross() matters.

In the default Exit handler for turfs, Uncross() is called for the turf itself and then Uncross() will also be called for any atoms in turf.contents that cover the entire tile. If any Uncross() call fails, Exit() fails too and will return 0. In games using pixel movement, Uncross() is usually called separately, but this allows projects using tile-based movement instead to benefit from Cross() and Uncross().

### See also
- [Enter proc (atom)](https://ref.dm-lang.org/atom/proc/Enter.md)
- [Entered proc (atom)](https://ref.dm-lang.org/atom/proc/Entered.md)
- [Exited proc (atom)](https://ref.dm-lang.org/atom/proc/Exited.md)
- [Cross proc (atom)](https://ref.dm-lang.org/atom/proc/Cross.md)
- [Crossed proc (atom)](https://ref.dm-lang.org/atom/proc/Crossed.md)
- [Uncross proc (atom)](https://ref.dm-lang.org/atom/proc/Uncross.md)
- [Uncrossed proc (atom)](https://ref.dm-lang.org/atom/proc/Uncrossed.md)
- [Move proc (movable atom)](https://ref.dm-lang.org/atom/movable/proc/Move.md)
- [movement_mode var (world)](https://ref.dm-lang.org/world/var/movement_mode.md)
