# How to control the increment of a number variable?

KongChan shared this question 2 months ago

I would like to report a potential issue in GeoGebra.

When trying to control the increment of a number variable, say x, I used to adjust the increment value of x in the slider panel. For example, if I want x to be integers, I would set the increment value to be 1. This method worked well in the past. Recently, I have found that the variable x could still assume non-integer values even after the above-mentioned setting.

I have found this issue on a desktop Windows version of the GeoGebra (Classic 6) and on an applet on my GeoGebra website. The link of the applet is attached for your easy reference: https://www.geogebra.org/m/wmtbjgta

Thanks for any assistance! 1

The advice is: use x, y and z for functions and not for number values. Controlling the increment of number values is still the same.

chris 1

There is no slider/number called "x" here https://www.geogebra.org/cl... 2

Even with very old version of GeoGebra :

when you have a slider a (min=1, max=99, increment=1), and an input box InputBox(a), you can enter (for example) 2.5 in the input box, and your slider a=2.5 !

_________________________

If you want enter a value which is an integer between 1 and 99 in your input box InputBoxDividend

InputBoxDividend -> Properties -> Script on Update

`SetValue(divid,If(divid<0∨divid>99∨floor(divid)!=divid,?,divid))`
Try in the file KongChan

___________________________

When you change the value of dividend, il you want to keep the old value when enter is not good

Create a number dividold=99

and write, in script on Update

```SetValue(divid,If(divid<0∨divid>99∨floor(divid)!=divid,dividold,divid))
SetValue(dividold,CopyFreeObject(divid))```
Try in KongChan2 1

Thank you very much for all your valuable advice (in particular jumera)! Now I know how to improve my applet. Thanks! 