Boolean to number

Is there a way to turn a boolean value into a number?
I want to keep track of how many slides my students get correct and post that on the last pages.
I have values for each slide, stored in a graph and then I am adding them up.

This is what I am trying, but it tells me it expected a number, but got a boolean.

number(“c_2”): choice2.isSelected(2)

Thanks

Good morning,

I think the easiest way to do this would be to use a conditional statement.

number(“c_2”):  when choice2.isSelected(2) 1 otherwise 0

I hope this helps.

1 Like

Thanks, that worked!

I tried something similar, but I had =1 instead of just 1.