Dump variables to global scope

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.

https://github.com/timholy/Rebugger.jl can be used for this.

1 Like

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