![]() |
Forum Index : Microcontroller and PC projects : Save Variable
Author | Message | ||||
Gerad Regular Member ![]() Joined: 10/01/2024 Location: GermanyPosts: 49 |
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: 2642 |
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: 5091 |
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: 49 |
Thank you for your quick assistance have a nice weekend |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |