Today’s dumb question!
This is a Golf project that I am working on. Three variables. Hole No. Stroke No. and Total Score.
The hole is incremented by a keypad button press - no problems so far. The strokes are incremented by a separate keypad button press.
Each time a increment to a new hole I reset the stroke number. No problems here.
What I would like to achieve is to have the total score incremented with the Stroke number, however with each new hole I reset the Stroke value, which in turn resets the Total. No good. I need to hold the Total value and increment with each new Stoke.
Any suggestions on how I hold the last total value, even when the Stroke are zeroed, and add to it with each Stroke increment?
//part code of incrementing the Hole no.
switch (keyval){
case'5':
if (hole <18)
hole++; //hole # up
stks=0; // reset strokes with each new hole - this is where I //would like the total to remain at the last value and have it //incremented with each Stroke key press
[color=#ffff00]tot=stks[/color];
displayScore();
break;
}
.