Question: What are the differences between this:

```
if(a && b)
{
     //code
}

```

and this:

```
if(a)
{
     if(b)
     {
          //code
     }
}

```

From what I know `b` will only get evaluated in the first code block if `a` is true, and the second code block would be the same thing.

Are there any benefits of using one over the other? Code execution time? memory? etc.

Answer: 
It makes a difference if you have an **else** associated with each **if**.

```
if(a && b)
{
     //do something if both a and b evaluate to true
} else {
    //do something if either of a or b is false
}

```

and this:

```
if(a)
{
     if(b)
     {
          //do something if both a and b are true
     } else {
          //do something if only a is true
     }
} else {
     if(b)
     {
          //do something if only b is true
     } else {
          //do something if both a and b are false
     }
}

```
If there is nothing in between two `if` statements in your second example then definitely first one is more cleaner and more readable.

But if there is a piece of code that could fit in between the two if conditions then only way is second example.