Order of presentation and CS108 and "seeing it" The structure is there But it takes a while to see it correctly Practice! Today we'll look at a lot of examples The logic should make sense Nesting: One thing inside another In this case, one "if" statement inside another "inside": If statements control a block if(something){ This is inside the block So is this } This is not inside the block for the "if" statement App Inventor made it easier to see what was inside each "if" statement Since the "if" statement held other pieces These are the same everywhere "if" inside the shader for the extra little houses The importance of proper formatting: It is not important to the compiler It should be important to you! Be consistent within the same program Ctrl+t will fix indentation automatically Nesting: Let's find a nested "if", and figure out why Look inside 492 game engine or vulkan tutorial Logic: nested "if" expresses logical AND You can often use && instead Make an example, with a loop and numbers that match or don't match This will nest an "if" inside a loop! Avoiding nesting: Sometimes you can deal with error or easy conditions early That can avoid nesting Example in lurk server Nesting, and number of levels: Generally, more levels make it harder to understand the program However, you often need several levels of nesting If you've got more than 4 levels, try very hard to simplify Hunt for examples in the Linux kernel Active Learning that won't be graded or anything Convert this nested "if" statement to a non-nested "if" that does the same thing: if(x > 5){ if(y < 3){ println("A"); } else { println("B"); } }