Error using the "If" Command

Dave Yrueta shared this question 1 year ago

Using the "If" command for writing scripts is producing strange errors. After defining a point A and slider for n, the example copied from the Manual

If(Mod(n, 7) == 0, SetCoords(A, n, 0), SetCoords(A, n, 1))

also produces an error. Am I doing something wrong?

Thanks for the help!

Comments (3)


It should be this way round:

SetCoords(A, n, If(Mod(n, 7) == 0,0,1))
If that doesn't help, please post your .ggb file


What error message? What version of Geogebra?

I have just tried this same example, copying and pasting your command directly, and it worked fine for me:


Where are you placing the If instruction?


Hi pisquared -- Thank you for posting your screenshot. That cleared up the problem. Defining A = Point({21, 0}) instead of A=(21, 0) produced the error. I thought Point objects needed to be defined in terms of bracketed lists.

© 2023 International GeoGebra Institute