# Dump variables to global scope

**URL:** <https://discourse.julialang.org/t/dump-variables-to-global-scope/15802>\
**Category:** General Usage\
**Created:** [October 2, 2018, 7:47pm UTC](https://discourse.julialang.org/t/dump-variables-to-global-scope/15802 "2018-10-02T19:47:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonjilla](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Post date:** [October 2, 2018, 7:47pm UTC](https://discourse.julialang.org/t/dump-variables-to-global-scope/15802/1 "2018-10-02T19:47:25Z")

</div>

Hello

I’m having trouble debugging some scripts due to how variables are now set to local within for/try/while blocks

It’s easy to debug other languages, because I can see what the state of the variables were when it failed

I know I can set all variables one by one into global scope or add print statements so that I can debug something that is deep in several nested loops, but I wonder if there is some override mode where I can dump all variable values into global scope upon error. Is there a way to achieve something like that? or a debug mode where all variables are global that I can use during debugging?

I’m not a programmer, so I apologize if this is a dumb request, but with other simpler languages like python or Tcl, I’ve never had to deal with this in this way so I’m having trouble and it’s taking me a lot longer to get scripts working.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [October 2, 2018, 7:48pm UTC](https://discourse.julialang.org/t/dump-variables-to-global-scope/15802/2 "2018-10-02T19:48:37Z")

</div>

[GitHub - timholy/Rebugger.jl: An expression-level debugger for Julia with a provocative command-line (REPL) user interface](https://github.com/timholy/Rebugger.jl) can be used for this.

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [October 2, 2018, 8:24pm UTC](https://discourse.julialang.org/t/dump-variables-to-global-scope/15802/3 "2018-10-02T20:24:27Z")

</div>

You could also use a `try` and `catch` block to handle exceptions and print messages in that case.
