Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:48 26 Nov 2024 Privacy Policy
Jump to

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: Germany
Posts: 42
Posted: 07:26am 01 Mar 2024
Copy link to clipboard 
Print this post

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: Australia
Posts: 2135
Posted: 07:36am 01 Mar 2024
Copy link to clipboard 
Print this post

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: Netherlands
Posts: 4233
Posted: 08:32am 01 Mar 2024
Copy link to clipboard 
Print this post

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: Germany
Posts: 42
Posted: 09:39am 01 Mar 2024
Copy link to clipboard 
Print this post

Thank you for your quick assistance
have a nice weekend
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024