We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I am struck in a place where I am not able to access the number of 'true' values from an array of boolean. Example - I have an array list of 500 booleans. Where two of them are 'true' and rest are 'false'. How to I tell computer to count the number of true values from the array list.?
Answers
some thing like this should do it (untested):
trues
now holds the number of trues in the array...Tested:
Please refer the code above. (Ignore font).
Actually I am not able to reduce the count whn I remove the button.
@infsys
can you please resend it arranged so that I will check on my system.
Idk how to do it. I was posting a question about an import of android, then having a look of some questions to see if I can help. How did you do it? maybe I can paste the example the right way.
or just click enter in front of any semicolon/curly brace
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text#latest
Your code above works. The only thing is that you are not using the number...
You do a
println(rem1)
,rem1
is never initialized and will always print 0 (default value). The local vartrues
is being set to the number of "selected" squares in your grid. But you never use it.Also the
println()
should be after the for loop, or it will print teh whole sequence.try:
Here, all together:
@_vk - thanks a lot for reply. :)