i've been searching a clean and correct way to use very long if statements.
multiple options:
Expand|Select|Wrap|Line Numbers
- if (cond1 && cond2 && (cond3 && cond4) && (cond5 || cond6) {
- // do this
- }
Expand|Select|Wrap|Line Numbers
- if (cond1) {
- if (cond2) {
- if (cond3 && cond4) {
- if (cond5 || cond6) {
- // do this
- }
- }
- }
Expand|Select|Wrap|Line Numbers
- if ( CheckCondition() ) {
- // do this
- }
- public bool CheckCondition () {
- return bool a = cond1;
- bool b = cond2;
- bool c = (cond3 && cond4);
- bool d = (cond5 || cond6);
- }
What would be the best way to use, what are the points I should pay attention to? Are there any other options to obtain a fast and clean statement?
Thank you very much for the tips