Invalid Input during local variable declaring - 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: Invalid Input during local variable declaring (/thread-161.html) |
Invalid Input during local variable declaring - Kevin Ouellet - 12-18-2013 11:33 PM I wonder if this is a bug or something I am doing wrong, but here's my code: Code: initialize(); Basically, on the "LOCAL" line, I get an Invalid Input error. I checked some other people's source code for the right syntax and I seem to have the right one, so I am unsure what's wrong. Am I triggering some firmware bug or am I doing something wrong? ??? Any help would be appreciated, else I'll have to stick to global variables and in the worst case scenario, switch back to A-Z vars as I was using before (which makes the code more confusing and isn't good practice). RE: Invalid Input during local variable declaring - Michael de Estrada - 12-18-2013 11:49 PM You can only have a maximum of 8 variable declarations or 4 variables with value assignments in a single LOCAL statement. So just make a second LOCAL statement for the fifth variable. RE: Invalid Input during local variable declaring - Kevin Ouellet - 12-18-2013 11:55 PM It still doesn't work even with a second LOCAL statement :/ LOCAL colHeight := 0, heightChg := 0, heightChgDir := .03, bgOffset := 0; LOCAL enterPressed := 0; Now the error only happens during runtime, though, not debugging. During debugging, it now just randomly "This application has crashed and will be restarted" or give Runtime errors then exits. Even if I set those variables as global vars at the start of the program I still get the Invalid input error. EDIT: Nevermind, I might have accidentally swapped two variables when switching from the A to Z ones. My bad. Thanks. Btw: Seriously, to those who plan to get an HP Prime reading this post: The emulator doesn't do it justice. It's so buggy compared to the real thing. The real calc crashes much less often and since the firmware update it's even better. The emulator is just brutal in terms of stability and when it starts crashing, it becomes no longer functional (actually, if the connectivity kit is open, the emulator even becomes sentient sometimes). RE: Invalid Input during local variable declaring - Han - 12-19-2013 12:59 AM Get rid of the ":=" and replace them with just "=" when initializing local variables with a starting value. As for variable limits -- it's 8 per instance of LOCAL regardless of initial values (16 bits used, half for local vars and the other half for corresponding initial values). RE: Invalid Input during local variable declaring - Michael de Estrada - 12-19-2013 02:30 AM (12-19-2013 12:59 AM)Han Wrote: Get rid of the ":=" and replace them with just "=" when initializing local variables with a starting value. So, is the Prime Help incorrect, because it shows the syntax var_1:=value ? RE: Invalid Input during local variable declaring - Han - 12-19-2013 04:10 AM (12-19-2013 02:30 AM)Michael de Estrada Wrote:(12-19-2013 12:59 AM)Han Wrote: Get rid of the ":=" and replace them with just "=" when initializing local variables with a starting value. No, I'm the one who's incorrect. The "=" and ":=" are both acceptable. The issue he was having is that his whitespace was a different whitepspace from what the HP Prime accepts, among other issues (haven't quite fully debugged) RE: Invalid Input during local variable declaring - cyrille de brébisson - 12-20-2013 09:20 AM Hello, No syntax error in the program. However some of your white spaces are NOT hex 20 (ie, normal) white spaces but are some unicode spaces... I have no clue how they got there, but do a check on your program and you will see that each error is on a white space. do backspace and then space to replace them and then it works... Unicode si a beast and so prone to errors with so many characters that look identical (or are), witout actually beeing the same! Cyrille |