variable name characters allowed. - 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: variable name characters allowed. (/thread-9495.html) |
variable name characters allowed. - webmasterpdx - 11-15-2017 11:50 AM Is there a way to know what characters can be used in a variable name and also as the first character in the name. e.g. V_1 is a valid variable name, but _V1 is not. Also, there are "other" characters from the Char key that are allowed, but I don't know how to tell which ones are valid. e.g. %1 is valid, but $1 is not. Likewise some of the odder characters like the w omega character is valid, and others are not. I test them by trying them out. Anyway, if anyone knows whats valid in the name and also what is valid for the first character...please let me know. Note that while I can use regular alpha chars, I was thinking there might be uses in obfuscation for those who want to protect their program code. RE: variable name characters allowed. - Joe Horn - 11-15-2017 02:48 PM The HP Prime User Guide says this: "The name of a variable must be a sequence of alphanumeric characters (letters and numbers), starting with a letter. Names are case-sensitive, so the variables named MaxTemp and maxTemp are different." RE: variable name characters allowed. - webmasterpdx - 11-15-2017 06:47 PM Yet %1 is not alpha numeric and there are other weird characters that are not alphanum, like a zeta with a circle at the center....from the Char button. RE: variable name characters allowed. - DrD - 11-15-2017 06:52 PM %1 doesn't work in [CAS]. RE: variable name characters allowed. - webmasterpdx - 11-15-2017 07:10 PM That's interesting. I can do %1:=1 in Home, but not in CAS and when defined in Home, to try to read %1 in CAS doesn't work, but it does in HOME. RE: variable name characters allowed. - cyrille de brébisson - 11-16-2017 05:52 AM Hello, Here is the code that identifies an identifier (var names and the like) Code:
Cyrille[/code] RE: variable name characters allowed. - webmasterpdx - 11-16-2017 06:13 AM Ah, interesting....of course! It's unicode. I forgot about that. Thanks Cyrille. -Donald |