Java Tutorial #7 — Nested If / else structure and logic

*Note*: My apologies for the volume being somewhat screwed up, Starcraft II turned up microphone boost on its own. This gets fixed in a few videos.

Topics Discussed: The structure behind using nested if statements effectively and how easy it is to get them confused!

Source Code Available Here

Nested if structure
In this video I give you a fairly simple example as to why we should avoid nested if statements whenever we possibly can. The primary reason behind this is because they syntax is overwhelming, and it simply becomes very difficult to read / understand.

The syntax of a nested if is exactly the same as a normal if / else statement, except that it takes place in the ‘payload’ of an existing if / else statement.


There isn’t really too much to write up about this lesson, as it built off of what we covered in the lesson before now. Just watch your syntax and you should be able to grasp this almost immediately.

Leave a Reply

Your email address will not be published. Required fields are marked *