How do you destroy/delete a variable in debugger?

enrique.elizaga
Advocate Advocate
0 Views
1 Reply
Message 1 of 2

How do you destroy/delete a variable in debugger?

enrique.elizaga
Advocate
Advocate

[ FlexSim 18.2.2 ]

Hi, Im debugging a code and sometimes you have many variables that you are not using anymore in the middle or ending part of the code. Especially if you arrange by blocks. Can I forget a variable that I am no longer using to only see the ones I want? I have seen that FlexSim does this during the "for" cycles. It uses the counter or index and when the cycle is finished, the variable is not there in the debugger screen anymore.

Accepted solutions (1)
1 View
1 Reply
Reply (1)
Message 2 of 2

matthew_gillespie
Not applicable
Accepted solution

The reason the variables in for loops disappear is that they go out of scope. The basic idea being that if a variable is defined within a set of curly braces ( { int x = 0; } ) it can only be used within those curly braces and is forgotten after leaving that set of curly braces. This image from this site is a good example:

Other than correctly scoping your variables, I don't know of any way to delete a variable in the debugger.