HP Forums
Delete all user defined variables - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Delete all user defined variables (/thread-4048.html)



Delete all user defined variables - DrD - 06-01-2015 02:46 PM

HVars is a list of HOME user defined variables. DelHVars requires either the element number or the element name from the HVar list, in order to delete a user defined variable. Too bad DelHVars(); doesn't just delete them all, as its namesake implies.

Aside from block loops, is there another way to delete ALL of the user defined variables in the HVars list, via command line or programmatically (without the Vars or Mem keys)?

-Dale-


RE: Delete all user defined variables - Tim Wessman - 06-01-2015 02:57 PM

We specifically did not allow that because the risk of accidentally typing something wrong... and boom - all gone.


RE: Delete all user defined variables - DrD - 06-01-2015 03:10 PM

Well... you seem to have done a good job! Any hints on how we can defeat that limitation(???)

-Dale-


RE: Delete all user defined variables - Didier Lachieze - 06-01-2015 03:36 PM

(06-01-2015 02:46 PM)DrD Wrote:  Aside from block loops, is there another way to delete ALL of the user defined variables in the HVars list, via command line or programmatically (without the Vars or Mem keys)?
This seems to work: EXECON("DelHVars(&1)",HVars)
It deletes all user defined variables and returns a list with the status of each variable deletion (should be a list of "1"s if deleted successfully).

EDIT: if you want to avoid an error message "Error: Invalid input" if there is no user defined variables, then you can do:
IFTE(SIZE(HVars),EXECON("DelHVars(&1)",HVars),0)


RE: Delete all user defined variables - DrD - 06-01-2015 04:19 PM

Good catch! I like the idea of the list of success values. Thanks!

-Dale-