# list depending on checkbox

nidzela shared this question 12 years ago
Answered

i was trying to find through the forum an obvious answer, which finally came to my mind during the quest.

can you create a list that changes depending on the values of a certain number of checkboxes?

yes, of course (here you'll get an example of it). but when i was trying this particular code, it didn't work as expected...

Scene=Si[R2≟"true", Si[CV≟"true", Ltt, Ltf], Si[CV≟"true", Lft, Lff]]

and why not? just because of the ""! the correct version is:

Si[R2 ≟ true, Si[CV ≟ true, Ltt, Ltf], Si[CV ≟ true, Lft, Lff]]

my doubt has been cleared now, but i post it anyway just in case it can help anyone.

## Comments (3)

1

Shortest possibility is

Si[R2, Si[CV, Ltt, Ltf], Si[CV, Lft, Lff]]

You can also use that

true = 1

false = 0

so you can also use

Element[{Lff,Ltf,Lft,ltt},2*R2+CV+1]

1

kondr is faster than I ... :P

If you have several checkboxes like c1, c2, c3, ... you can get the number of checked checkboxes by a term like:

n = c1+c2+c3+...

Birgit

1

Shortest possibility is

[...]

so you can also use

Element[{Lff,Ltf,Lft,ltt},2*R2+CV+1]

very nice idea, indeed!

about 0 and 1 as equivalent to false and true, i remember trying to use it in the past, but probably i did it wrong and never explored it anymore.

thanks for both useful comments, kondr and Birgit!

Leave a Comment
• GeoGebra
• Help
• Partners
• Contact us
• Feedback & Questions
• This email address is being protected from spambots. You need JavaScript enabled to view it.
• +43 677 6137 2693
© 2022 International GeoGebra Institute