How to optimize complex if statement
in
Programming Questions
•
2 years ago
I have this beast in my code:
- if(pixel[0][5] < 800 || pixel[0][6] < 800 || pixel[0][4] < 800 ||
- pixel[1][4] < 800 || pixel[1][5] < 800 || pixel[1][6] < 800 || pixel[1][7] < 800 || pixel[1][3] < 800 ||
- pixel[2][4] < 800 || pixel[2][5] < 800 || pixel[2][6] < 800 || pixel[2][7] < 800 || pixel[2][3] < 900||
- pixel[3][4] < 800 || pixel[3][5] < 800 || pixel[3][6] < 800 || pixel[3][7] < 800 || pixel[3][3] < 800 ||
- pixel[4][5] < 800 || pixel[4][6] < 800 || pixel[4][7] < 800)
- { do something }
any suggestions on how to simplify this?
context: I have a large array of data, and need to trigger certain actions when one value of a specific group reaches a certain number.
If someone could suggest a better way of 'asking' this, that would be amazing. (or point me to a tutorial)
Thanks
p.
1