Can someone explain this what it is doing?

if ( condition1 && condition2 && condition3 && condition4 && condition5 ) { code }

It doesn't do what I want it to do but this does.

if ( condition1 ) {
    if ( condition2 ) {
        if ( condition3 ) {
            if ( condition4 ) {
                if ( condition5 ) {

Recommended Answers

All 3 Replies

if the code is like this, functionally there shouldn't be a difference.

I thought they were different but it turns out there is a bug with my logical process. And after running the code enough times the second code began to act the same as the first code, it was just by luck that it seemed to fix itself.

code doesn't really "fix itself". if the problem existed for certain input, it'll still be there. you should look into that to see if you didn't make an error in placing a bracket or something

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.