If loop is not working in button

sachchidanand shared this question 2 years ago
Answered

I created a slider


n = Slider(1,10,1)

and want to move it from the button. So I created a next button with the scripting


If(n <= 9, n = n + 1)

But the button is not working at all. Once it worked but now it fails to work. Is it some bug or something else?

Comments (4)

photo
1

use this syntax

n=If(n <= 9, n + 1,1)

photo
1

Better:


SetValue(n, If(n <= 9, n + 1,n))

(Don't use "=" in scripts, and typo corrected)


photo
1

Ok ,thanks

photo
1

@Borcherds, thanks.

photo
© 2023 International GeoGebra Institute