All language subtitles for 3. While Loops - General Structure

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,120 --> 00:00:07,200 So what types of loop's we may have, actually, we may have a few different types of looping control 2 00:00:07,200 --> 00:00:11,550 structures, such as while loops do while loops and Forell loops. 3 00:00:11,700 --> 00:00:18,730 And although all of them are used with the loops context, some are better for one thing, while others 4 00:00:18,750 --> 00:00:20,520 are better for a another. 5 00:00:20,670 --> 00:00:22,560 It simply depends on the task. 6 00:00:22,740 --> 00:00:27,930 It's just the the the way you control how to iterate, how to run your loop. 7 00:00:28,470 --> 00:00:30,810 That's basically what is different between them. 8 00:00:30,960 --> 00:00:36,840 And in these video, we are going to focus and we are going to talk about the first one. 9 00:00:36,990 --> 00:00:41,490 The while loop, some of the while loop is one of the first loops being taught. 10 00:00:41,640 --> 00:00:46,440 And the reason for that is because this type of loop is probably the easiest one. 11 00:00:46,620 --> 00:00:52,970 So how it's structure looks like, first of all, you specify that it's a while loop, right. 12 00:00:52,980 --> 00:00:54,720 That we are using gay while loop. 13 00:00:54,750 --> 00:00:59,780 By using this statement while then you write down the loop conditions. 14 00:00:59,840 --> 00:01:06,930 So a while loop has its own condition and did the result of this condition happens to be true? 15 00:01:06,990 --> 00:01:12,630 If it happens to be true, then we are going to execute the associated block of commands. 16 00:01:12,720 --> 00:01:15,450 Or is it also called the loop body? 17 00:01:15,540 --> 00:01:23,370 The loop commands and we can think of the loop body as we can see it in this illustration is some different 18 00:01:23,370 --> 00:01:25,860 tasks that these guy has to do. 19 00:01:26,220 --> 00:01:32,820 For example, he has to talk on the phone, listen to customers, try to find bugs in his code and so 20 00:01:32,820 --> 00:01:33,090 on. 21 00:01:33,240 --> 00:01:35,250 So that would be the loop body. 22 00:01:35,250 --> 00:01:41,910 For example, these guy comes to work and as long as some condition happens, as long as it's true, 23 00:01:42,420 --> 00:01:48,180 he executes all the commands, all his tasks that are a specified thing, the loop body. 24 00:01:48,270 --> 00:01:54,900 Now, maybe this illustration looks kind of funny for you, but we are going to see in the next chapters 25 00:01:55,230 --> 00:01:59,640 why we kind of dwell on these kind of explanations. 26 00:01:59,640 --> 00:02:00,050 Sand. 27 00:02:00,100 --> 00:02:05,850 You are going to understand that starting these months, you are yelling that way is much easier. 28 00:02:05,970 --> 00:02:07,170 It's much easier. 29 00:02:07,200 --> 00:02:15,120 Guys, trust me and you will get much more out of it right then instead of just going out and see how 30 00:02:15,120 --> 00:02:17,880 it will look like in our code and how what what you say. 31 00:02:17,880 --> 00:02:18,300 Right. 32 00:02:18,420 --> 00:02:18,670 OK. 33 00:02:18,960 --> 00:02:21,960 Understand the concepts behind every section. 34 00:02:22,230 --> 00:02:28,020 And it will take you much, much less time to get a hold of everything else. 35 00:02:28,140 --> 00:02:34,740 And lastly, using Goller while loops, we are going to execute these commands in the loop body that 36 00:02:34,740 --> 00:02:35,730 you can see on the right. 37 00:02:36,090 --> 00:02:40,590 As long as the condition of these while loop happens to be true. 38 00:02:40,830 --> 00:02:47,910 So when it happens to be false, we are going to stop executing these low body, these commands inside 39 00:02:47,910 --> 00:02:48,090 of it. 40 00:02:48,100 --> 00:02:52,470 We will see in the next examples how it will look like also in our code. 41 00:02:52,770 --> 00:02:55,710 So things are going to be much more clear to you. 42 00:02:55,860 --> 00:02:59,670 But before we do so, let's explain this illustration once again. 43 00:03:00,000 --> 00:03:02,940 We can say that these guy let's call him Jacob. 44 00:03:03,090 --> 00:03:05,460 Jacob comes to work here on the left. 45 00:03:05,460 --> 00:03:07,800 And while a certain condition is not false. 46 00:03:07,830 --> 00:03:10,620 For example, while his shift is not over. 47 00:03:10,770 --> 00:03:14,060 He's going to execute the loop body tasks. 48 00:03:14,130 --> 00:03:14,970 Is that clear? 49 00:03:15,120 --> 00:03:18,360 So he goes to work checks if the shift is not over yet. 50 00:03:18,510 --> 00:03:21,260 And the result for that, he's going to be true. 51 00:03:21,270 --> 00:03:22,320 It's not over yet. 52 00:03:22,470 --> 00:03:28,530 Then he does these tasks of going on the phone, fixing some bands, writing some code and so on. 53 00:03:28,710 --> 00:03:34,770 And afterwards, once he's down one iteration, we are going to explain it right away. 54 00:03:34,980 --> 00:03:41,190 Once you're done one cycle of this loop, he's going to ask the same question in the same condition 55 00:03:41,190 --> 00:03:42,120 once again. 56 00:03:42,270 --> 00:03:49,530 So if his shift at work is not over, he is going to iterate and to run this low body once again. 57 00:03:49,570 --> 00:03:53,550 He's going to do he's it's a cycle of tasks. 58 00:03:53,700 --> 00:04:00,030 Once, once again, and as long as the result of the question will be true, meaning that the shift 59 00:04:00,030 --> 00:04:00,840 is not over. 60 00:04:00,960 --> 00:04:06,420 Jacob is going to do all of his tasks once the result of the condition will be false. 61 00:04:06,450 --> 00:04:11,390 Then Jacob in this case will go home and not run the loop body again. 62 00:04:11,430 --> 00:04:14,700 He will not do any of these phone calls. 63 00:04:14,940 --> 00:04:16,140 He's done for today. 64 00:04:16,170 --> 00:04:17,190 He can go home. 65 00:04:17,310 --> 00:04:20,250 And by the way, we can see that Jacob here on the right. 66 00:04:20,850 --> 00:04:23,040 He kind of gets mad at work. 67 00:04:23,100 --> 00:04:25,590 So don't get mad at war, guys. 68 00:04:25,710 --> 00:04:27,090 And it won't help you at all. 69 00:04:27,300 --> 00:04:29,070 Simply calm down. 70 00:04:29,130 --> 00:04:33,330 Drink some tea and move on with your task with a smile. 71 00:04:33,420 --> 00:04:35,970 So now let's get back to our while loop. 72 00:04:36,060 --> 00:04:42,660 And we can say that when the condition of the while loop is false, then we just skip all the while 73 00:04:42,660 --> 00:04:48,870 code and we will see how it looks like in our programming language and move on with our program with 74 00:04:48,870 --> 00:04:51,990 whatever commands may appear afterwards. 75 00:04:52,110 --> 00:04:55,890 We are out of the slope when the condition is false. 76 00:04:55,980 --> 00:04:57,780 So I hope that's clear. 77 00:04:57,870 --> 00:04:59,340 And last. 78 00:04:59,490 --> 00:05:07,470 Note for this video is that the execution of Luke Buddy, one cycle of the Luke body, before we check 79 00:05:07,500 --> 00:05:14,130 the condition once again, one cycle from top to bottom just once is called an iteration. 80 00:05:14,370 --> 00:05:19,460 And basically a loop can have multiple iterations as part of it. 81 00:05:19,470 --> 00:05:19,750 Right. 82 00:05:20,070 --> 00:05:23,400 As long as the condition is not false. 83 00:05:23,520 --> 00:05:28,470 So let's take another a look and see how it will more resemble to our program. 84 00:05:28,620 --> 00:05:30,210 So there is zero code. 85 00:05:30,360 --> 00:05:31,520 Different commands. 86 00:05:31,530 --> 00:05:36,410 And there we come to a certain point where we see the wild statement. 87 00:05:36,470 --> 00:05:36,780 OK. 88 00:05:37,080 --> 00:05:38,800 So we are doing a lot of war. 89 00:05:38,860 --> 00:05:40,030 Jacob is at work. 90 00:05:40,050 --> 00:05:40,860 He's working. 91 00:05:41,190 --> 00:05:42,360 That's another example. 92 00:05:42,360 --> 00:05:43,410 Another illustration. 93 00:05:43,680 --> 00:05:44,730 Jacob is working. 94 00:05:45,240 --> 00:05:49,230 And we come to a point where we are going to use the while loop. 95 00:05:49,290 --> 00:05:53,550 So we we ask the question, the condition. 96 00:05:53,880 --> 00:05:55,710 We check this while loop condition. 97 00:05:55,740 --> 00:05:58,320 Does Jacob need to finish his work? 98 00:05:58,470 --> 00:06:04,800 And if this condition happens to be true, then we are going to execute some specific commands specified 99 00:06:04,800 --> 00:06:05,790 in the loop body. 100 00:06:06,180 --> 00:06:09,990 We do one iteration of the loop, just one iteration job. 101 00:06:10,260 --> 00:06:16,740 Jake, Jacob is just going to to keep working to execute some more tasks at his work. 102 00:06:16,890 --> 00:06:23,400 And once he's done executing these specific commands that he had to do, we are going back to check 103 00:06:23,400 --> 00:06:24,150 once again. 104 00:06:24,180 --> 00:06:28,620 If the condition is true or false, does Jacob need to finish his work? 105 00:06:28,820 --> 00:06:33,990 And if the condition is still true, then we are going to execute this code once again. 106 00:06:34,350 --> 00:06:40,500 And basically, we are going to repeat this whole process this cycle until the result of the condition 107 00:06:40,650 --> 00:06:42,840 is going to be false. 108 00:06:43,050 --> 00:06:49,320 So once the result of the condition is false, we can get out of the loop and proceed with our program 109 00:06:49,500 --> 00:06:54,990 and our other commands and then we can say that Jacob can go home. 110 00:06:55,290 --> 00:07:02,980 So that's basically the general structure of while loops are used here, a couple of illustration visualization. 111 00:07:03,130 --> 00:07:04,650 Call it whatever you like. 112 00:07:04,920 --> 00:07:08,430 That may help you a little bit understand the concept behind it. 113 00:07:08,850 --> 00:07:13,410 And we will see more practical, practical examples in this section. 114 00:07:13,770 --> 00:07:19,860 But still, I think it's nice to understand this loop structure a general. 115 00:07:19,890 --> 00:07:22,140 Before we dive into programming. 116 00:07:22,290 --> 00:07:26,640 So now let us see how it can be used in our programming language. 117 00:07:27,150 --> 00:07:27,690 Right away. 118 00:07:28,080 --> 00:07:29,790 I'll see you in the next video by. 10960

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.