Storing a Value and then using it

im currently creating a score board (which i have managed & it works fine, it starts at 0, 2x buttons and whenyou press a button the score counts up which works fine)

however id like to be able to add another function to it but i dont know where to start.

i want to be able to enter a max score. ie 20pts. and then the scoreboard will count down to 0pts

i can work out the count down part thats the easy, however its the entering the inital score and storing it as a value.

can anyone point me in the right direction ?

int score = 20;

void setup() {};

void loop() { if youlost() { score--; Debug.println(score) };

if (score == 0) { Debug.println("YOU LOST, NEXT GAME"); score = 20; } }

What do you mean by "entering the initial score"? How do you intend on doing that? In code? Via a switch? - Scotty

id like to be able to use a button to enter a max score, ie press button, everytime the button would be pressed it would increase the score, then i would hold button to set the score.

Look up debounce and you'll find how to use a button. If you measure the time the button is down then you can have a long press reset the button. I've used that for my LEDs to switch to a demo mode.