LoginLogin

Is there a way to reset all variables in SmileBASIC?

Root / FAQs / [.]

🔒
B05SxBrennanCreated:
If I remember correctly, CLEAR would set all variables back to zero in PTC. But CLEAR can only be used in direct mode now. Is there a new way to reset variables in SB?

Not really. I'd put all of your variables in a DEF block and allow SB function encapsulation take care of everything.

Make a function that clears every variable. You have to set every variable to zero manually I'm afraid.

Make a function that clears every variable. You have to set every variable to zero manually I'm afraid.
Even so, it doesn't uninitialize variables.

Thanks for the help guys. It's too bad SB doesn't have a less tedious solution to this though. Any idea why they'd remove such a useful feature?

Thanks for the help guys. It's too bad SB doesn't have a less tedious solution to this though. Any idea why they'd remove such a useful feature?
Because 1) encapsulation between functions/slots and 2) variables are automatically cleared on USE/EXEC/RUN.