Adding a variable to itself

Hi there,

Quick question (and hopefully a quick answer) - is it possible to add a variable to itself in desmos? In other words, can I define a variable then increment it somehow? For context I’d like to count how many times a student gets the answer correct on a randomly generated practice activity and eventually place a point value based on if they needed a hint or not.

Essentially I want something like this:

a= when “correct answer” a+1 otherwise a

I’ve got a good flow on randomly generating lots of different practice through the CL/calculator in activities, and I think this would be the next level to add some additional tracking engagement. I have fun gifs and word prompts that trigger when something is right, but no way to track how many questions a student actually attempted and got right.

I’m not certain there’s a way to do that, but there are other ways to accomplish what you want.

How is a new problem generated after one is completed?

Do you want them to be able to move on to a new problem before correctly solving the current one?

You’ll want to take advantage of using the capture sink when a student submits a problem. If all the problems are on one screen, you can create a variable in the calculator that checks for correctness. Set the variable to 1 on correct, set it to 0 if not correct. The button will capture those values and then you can use the calculator to perform some functions on the numberList history. Here’s an example.

Oooohhhh, Craig’s right. You can effectively increment (if that’s your end goal) by asking for the length of a numberList!

ok wow, very cool! I haven’t used any of this functionality before so I think I need to sit down and code out some examples for myself to internalize it-but yes, this is exactly what I’m looking for.