Hello guys and welcome.
And in this lecture we're gonna learn how to nest statements.
So essentially you know we've been talking about if statements and stuff like that.
Well you can actually nest them.
So how that works is it can be like this and then you can say print f hello world.
So then what will happen is if this is true which it is this one it will come in here.
Then it'll say if this is true and it isn't so it'll never get run but if both of these conditions are
true then it would run this.
And this is called nesting where you where you can nest statements down and down and down.
But you should be careful when doing this because too many statements can make the code look very ugly
like for example if I keep doing if statements constantly going down
Look how ugly it starts to look right.
Yeah.
So what I tend to do to get around that is let's say there's a function that is taking uh some arguments
and you want to check that the data is legal or valid first.
What I do is I check these legal and valid.
And if it isn't then I just return.
I just I just returned from the function you know usually it would be a void or something.
And I would just return or I would pass back a state so that way then you can just do your if statements
is normal because you know the if you finish the execution the program so much like if statements for
loops can also be nested all statements can.
So you know I could do something like this
so if if this statement is true which it is run this folded and then print whatever is in here.
So I just wanted to demonstrate that you can ness statements.
So it's quite an important thing to get across.