1 00:00:00,890 --> 00:00:06,410 In this lecture, we are going to see some examples to control flow first, create a class for this 2 00:00:06,410 --> 00:00:09,590 to so write like new class. 3 00:00:11,300 --> 00:00:20,810 Control follow up and to copy a main method from one of the fires we have created before. 4 00:00:24,190 --> 00:00:36,910 Copy and paste it here, and we're going to need three variables a boolean is damaged, is damaged. 5 00:00:38,350 --> 00:00:39,430 That will be through 6 00:00:42,550 --> 00:00:45,880 a string car color. 7 00:00:49,980 --> 00:00:52,890 Equals purple. 8 00:00:58,270 --> 00:01:05,920 And they charged energy efficiency category. 9 00:01:13,370 --> 00:01:25,960 He calls simple chords G and a semicolon, our first example is using is damaged, so F parentheses 10 00:01:26,140 --> 00:01:39,550 is damaged, curly braces and a system that our daughter Winterland double chords, damaged car now 11 00:01:39,580 --> 00:01:40,300 in our code. 12 00:01:41,240 --> 00:01:43,460 As you can see, damaged car is printed out. 13 00:01:43,580 --> 00:01:46,190 OK, let's change is damage to force. 14 00:01:47,700 --> 00:01:53,850 Now, run called again, as you can see, nothing is printed out now add an ounce to it. 15 00:01:55,240 --> 00:02:02,180 So here else, curly braces copied this line pasted here. 16 00:02:02,380 --> 00:02:03,850 Now change the text. 17 00:02:09,200 --> 00:02:10,070 When I called. 18 00:02:11,980 --> 00:02:19,460 As you can see, accident free car is printed out, so now instead of printing out, nothing is damaged 19 00:02:19,460 --> 00:02:22,990 is force accident free car is printed out. 20 00:02:23,140 --> 00:02:25,290 Let's move on to our stuff now. 21 00:02:25,690 --> 00:02:27,010 So F. 22 00:02:29,610 --> 00:02:37,110 Car color dot equals red curly braces. 23 00:02:38,220 --> 00:02:42,300 System dot out of print and double quotes. 24 00:02:42,780 --> 00:02:49,320 This car is red now at an Alice F. 25 00:02:50,730 --> 00:03:07,510 Else F Frantz's car color, that equals double quotes, green, curly braces system not out of print 26 00:03:07,510 --> 00:03:09,070 one copy the text. 27 00:03:11,010 --> 00:03:12,810 And change the red to green. 28 00:03:15,150 --> 00:03:25,380 Now add another one as well as it's car color, dot equals blue. 29 00:03:29,020 --> 00:03:38,350 Call it racist cop D-line and change green to blue, our honor code. 30 00:03:39,810 --> 00:03:43,340 And as you can see, nothing else is printed out, an accident free car. 31 00:03:43,470 --> 00:03:47,960 It's pretty obvious because we don't have any condition for purple. 32 00:03:48,480 --> 00:03:55,800 So instead of adding a house, if Corker equals purple, we add an ass here. 33 00:03:58,040 --> 00:03:59,240 Curly braces. 34 00:04:00,690 --> 00:04:05,340 Copied this line and changed the text to. 35 00:04:06,960 --> 00:04:20,130 I have no idea what's the color of the car or on the road again. 36 00:04:21,930 --> 00:04:27,300 And as you can see, the newly added code that belongs to Alse is executed. 37 00:04:28,690 --> 00:04:36,400 Now, let's see an example for which we are going to use energy efficiency category here, so switch 38 00:04:36,970 --> 00:04:45,850 energy efficiency category curly braces and let's just say we are lazy and we want to print out the 39 00:04:45,850 --> 00:04:49,410 same text for both A and B category. 40 00:04:49,900 --> 00:04:56,020 So case simple quote a column. 41 00:04:57,470 --> 00:04:58,160 Case. 42 00:05:00,740 --> 00:05:03,170 Simple codes, chords be. 43 00:05:04,670 --> 00:05:10,580 Colin into system that outthought Winterland double cotes. 44 00:05:12,720 --> 00:05:18,630 Low energy consumption. 45 00:05:22,100 --> 00:05:26,370 New line and brake words and a semicolon. 46 00:05:26,510 --> 00:05:29,600 Now let's add another case. 47 00:05:32,010 --> 00:05:39,990 G Colin system thought out that print on copy the text. 48 00:05:42,820 --> 00:05:51,280 Posted here and changed the tax to very high energy consumption and new line. 49 00:05:52,660 --> 00:05:56,280 A break and a semicolon now run out of code. 50 00:05:58,090 --> 00:06:04,390 OK, so as we expected, very high energy consumption is printed out because we have a case here. 51 00:06:04,550 --> 00:06:09,460 Now let's change the value of an energy efficiency category to a. 52 00:06:11,300 --> 00:06:16,760 Right now called again, and as you can see, low energy consumption is printed out now, change it 53 00:06:16,760 --> 00:06:18,680 to be run it again. 54 00:06:19,770 --> 00:06:23,580 So what's happened here in case of A and B? 55 00:06:24,570 --> 00:06:33,660 The same code is printed out now, change the value to Z, run our code again, nothing is printed out 56 00:06:33,660 --> 00:06:33,980 now. 57 00:06:34,530 --> 00:06:40,220 So our last move here is to add a Difford block to the switch. 58 00:06:40,770 --> 00:06:58,170 So enter default column and enter again system dot, dot printer and double codes, not defined category 59 00:06:58,920 --> 00:07:00,020 runner code again. 60 00:07:00,810 --> 00:07:07,440 So as you can see, because we change the value to see the not defined category text is printed out 61 00:07:07,440 --> 00:07:08,820 in the default block. 62 00:07:09,210 --> 00:07:09,810 All right. 63 00:07:10,110 --> 00:07:12,020 That's it about contraflow. 64 00:07:12,030 --> 00:07:14,010 I hope it was clear and useful. 65 00:07:14,010 --> 00:07:18,090 If it was not, feel free to ask C in the next lecture.