Answers for "How can I do a foreach loop for an array of booleans"

0

How can I do a foreach loop for an array of booleans

// The problem is not that your array is boolean,
 // it is that you are trying to assign value to buttonBoolean in foreach loop. It is read-only as every foreach iteration variable is
 
 // You could do this instead:
 
 public bool[] inputBool;
      
     for(int i = 0; i < inputBool.Length; i++) {
       inputBool[i] = false;
     }
Posted by: Guest on April-27-2020

Code answers related to "How can I do a foreach loop for an array of booleans"

Browse Popular Code Answers by Language