Simple checkbox problem

I have a super simple thing I need to do, but the solution eludes me. The issue is I have 16 checkboxes where each box has a value assigned and I just need to add up the values of the checked boxes only and dispay it (initially - will eventually send over BT). This is my first day looking at Mit app inventor so I have two questions.

  1. Why does this not work?
  2. Any thoughts on a better way to do this?

ifthen22

About
else if
https://www.w3schools.com/js/js_if_else.asp

1 Like

The elseifs are preventing the checkboxes after the first from being examined.
For this scheme to work, you need 16 independent if/then blocks, no else clauses.

Don't forget to add a set firstbyte = 0 before the first if/then, so you can reuse the code without having to restart your app.

(Juan Antonio beat me to it.)

2 Likes

@ABG
I think for 20 seconds.

2 Likes

Thanks for the quick reply, it worked perfectly!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.