So now we're going to do some practice on court blocks.
We are not going to create a new class for this.
We're going to use the code we created in the contraflow coding lecture.
All right.
We are going to use the example we used in the previous video.
So block starting, curly brace and and the ending braces added.
That's great.
And in there, one, two.
So starting curly brace and and incorporate it into here.
Now, define a number of owners variable.
So and number of owners equals five and a semicolon.
Now in the inner block use double plus sign operator or number of owners.
And a semicolon and print out the number of owners after the inner block, so extended out the printer
and double quotes a number of owners column and MySpace, plus sign number of owners.
Now, right now called.
A number of owners, six is printed out after the not defined category line.
Now move the definition of number of owners into the inner block.
So deleted from here and pasted here, as you can see, intergrated out the variable name, take the
cursor on the variable name.
It says variable number of owners is assigned but never accessed.
And if you take the cursor to the line under that, the value change, that number of owners plus plus
is never used.
And also in the printout line, variable name is read, it says cannot resolve a simple number of owners.
These are all correct.
As I said, the variable was created in the inner block and cannot be accessed after it because they
don't exist anymore.
If you scroll up and define a variable inside the if block like string hello equals hello, I'm the
semicolon and you would like to print out hello.
System that outdoes Princetonian.
How do you get the same error here to now revet all changes?
So the latest from here.
This one here.
And move it back here.
All right, that's all I wanted to say about coding blocks for now, I hope it was clear.
See in the next lecture.