So I have something like
bSuccess = true;
bSuccess = bSuccess && statement1();
bSuccess = bSuccess && statement2();
bSuccess = bSuccess && statement3();
...
Is there a better or more idiomatic way to write this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could chain it all together:
This is “idiomatic”, however it isn’t completely clear whether this type of code is clear. You are relying on the side-effects of each function call, so at the very least these should be well documented.