# How to stop script execution

**URL:** <https://discourse.julialang.org/t/how-to-stop-script-execution/38568>\
**Category:** General Usage\
**Created:** [May 1, 2020, 5:39pm UTC](https://discourse.julialang.org/t/how-to-stop-script-execution/38568 "2020-05-01T17:39:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Post date:** [May 1, 2020, 6:19pm UTC](https://discourse.julialang.org/t/how-to-stop-script-execution/38568/4 "2020-05-01T18:19:47Z")

</div>

This thread might be helpful to you. It sounds like you are trying to do something similar.

> [@A Julia equivalent to R's stop()?](https://discourse.julialang.org/t/a-julia-equivalent-to-rs-stop/36568/5):
>
> You could probably do something like: struct Stop{T} answer::T end function stop(answer) throw(Stop(answer)) end function start() stop(42) end try start() @info "No answer." catch ex if isa(ex, Stop) @info "Exit with: $(ex.answer)" else rethrow(ex) end end This assumes that you are not already catching exceptions in the stack. If you are then you probably want to throw a “Stop” object that the other exception handlers can rethrow. This is al…

---

_[View the full topic](https://discourse.julialang.org/t/how-to-stop-script-execution/38568)._
