Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Save Variable
Author | Message | ||||
Gerad Regular Member Joined: 10/01/2024 Location: GermanyPosts: 42 |
How can I save and reload the value of āvā? Example: Do ... v=v+1 ... Loop . Every time I edit something and start the program with run, the value of "v" =0. what am I doing wrong ? who can help me. Thanks |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
When a program starts all variables are set to 0 or "" for strings. The simplest way to save them is with VAR SAVE before the program ends then on restarting use VAR RESTORE to retrieve them. The manual has more details. The other method is to save them to a file. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4233 |
Hi Gerad, Whenever you feel the value of a variable should be "saved" in your program , do a "VAR SAVE variable" (i.e. VAR SAVE a$). In the beginning of your program you add the line "VAR RESTORE". You do not need to specify a variable, it restores everything that has been saved with VAR SAVE so far. Be aware though. When you "LOAD" a different program, the VAR SAVE memory is cleared. That is to prevent that values of one program polute another program at startup. Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
Gerad Regular Member Joined: 10/01/2024 Location: GermanyPosts: 42 |
Thank you for your quick assistance have a nice weekend |
||||
Print this page |