1 00:00:02,110 --> 00:00:04,770 So now we're going to do some practice on court blocks. 2 00:00:04,990 --> 00:00:07,200 We are not going to create a new class for this. 3 00:00:07,210 --> 00:00:11,440 We're going to use the code we created in the contraflow coding lecture. 4 00:00:12,190 --> 00:00:12,610 All right. 5 00:00:12,610 --> 00:00:15,720 We are going to use the example we used in the previous video. 6 00:00:16,210 --> 00:00:21,970 So block starting, curly brace and and the ending braces added. 7 00:00:22,570 --> 00:00:23,260 That's great. 8 00:00:23,260 --> 00:00:24,330 And in there, one, two. 9 00:00:24,850 --> 00:00:30,030 So starting curly brace and and incorporate it into here. 10 00:00:30,700 --> 00:00:33,510 Now, define a number of owners variable. 11 00:00:33,520 --> 00:00:42,380 So and number of owners equals five and a semicolon. 12 00:00:43,000 --> 00:00:48,790 Now in the inner block use double plus sign operator or number of owners. 13 00:00:52,230 --> 00:00:59,200 And a semicolon and print out the number of owners after the inner block, so extended out the printer 14 00:00:59,220 --> 00:01:09,990 and double quotes a number of owners column and MySpace, plus sign number of owners. 15 00:01:11,170 --> 00:01:12,250 Now, right now called. 16 00:01:15,410 --> 00:01:19,830 A number of owners, six is printed out after the not defined category line. 17 00:01:20,090 --> 00:01:24,350 Now move the definition of number of owners into the inner block. 18 00:01:24,950 --> 00:01:33,290 So deleted from here and pasted here, as you can see, intergrated out the variable name, take the 19 00:01:33,290 --> 00:01:35,180 cursor on the variable name. 20 00:01:35,540 --> 00:01:40,460 It says variable number of owners is assigned but never accessed. 21 00:01:40,460 --> 00:01:47,850 And if you take the cursor to the line under that, the value change, that number of owners plus plus 22 00:01:47,870 --> 00:01:48,890 is never used. 23 00:01:49,400 --> 00:01:56,170 And also in the printout line, variable name is read, it says cannot resolve a simple number of owners. 24 00:01:56,690 --> 00:01:57,920 These are all correct. 25 00:01:58,190 --> 00:02:04,580 As I said, the variable was created in the inner block and cannot be accessed after it because they 26 00:02:04,580 --> 00:02:05,940 don't exist anymore. 27 00:02:06,530 --> 00:02:20,370 If you scroll up and define a variable inside the if block like string hello equals hello, I'm the 28 00:02:20,420 --> 00:02:23,210 semicolon and you would like to print out hello. 29 00:02:25,440 --> 00:02:27,420 System that outdoes Princetonian. 30 00:02:28,920 --> 00:02:33,980 How do you get the same error here to now revet all changes? 31 00:02:34,930 --> 00:02:36,430 So the latest from here. 32 00:02:37,750 --> 00:02:38,740 This one here. 33 00:02:40,400 --> 00:02:43,370 And move it back here. 34 00:02:44,090 --> 00:02:49,140 All right, that's all I wanted to say about coding blocks for now, I hope it was clear. 35 00:02:49,400 --> 00:02:50,830 See in the next lecture.