How to make a save function?
It's the title
Anyway, i'm making a pokémon game with 24 gyms so long i guess, i need save thanks.
A database is a good thing to use! If its in Python, well your in luck! On the side of your repl editor, you will see some database stuff here:
A quick tip for saving numbers:
Do NOT declare it. Here is an example:
from replit import db db["MyNumber"] = 0 userInput = int(input("Enter an integer:")) db["MyNumber"] += userInput #Do NOT do this, it will reset it to 0 everytime the repl starts
from replit import db userInput = int(input("Enter an Integer:")) db["MyNumber"] += userInput print(db["MyNumber"]) # Do this! It will not get reset to 0!
I think you get the idea, anyways, hope this helps!
What do you mean by function, Is it
Or it is the score or something?
If you want to store the score of the player, then you can something Database. There are lot of them but I suggest some of them like Repl DB, Mongo DB, etc.
Here are some tutorials on how to use Mongo DB:-
That's it for me
Hope this helps