DO Loop - Introduction

3 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€87.69
List Price:  €122.77
You save:  €35.08
£75.17
List Price:  £105.24
You save:  £30.07
CA$138.15
List Price:  CA$193.41
You save:  CA$55.26
A$156.01
List Price:  A$218.42
You save:  A$62.41
S$131.13
List Price:  S$183.59
You save:  S$52.46
HK$775.83
List Price:  HK$1,086.19
You save:  HK$310.36
CHF 82.37
List Price:  CHF 115.32
You save:  CHF 32.95
NOK kr1,040.74
List Price:  NOK kr1,457.09
You save:  NOK kr416.34
DKK kr654.68
List Price:  DKK kr916.58
You save:  DKK kr261.90
NZ$167
List Price:  NZ$233.81
You save:  NZ$66.80
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳12,244.69
List Price:  ৳17,143.06
You save:  ৳4,898.36
₹8,541.58
List Price:  ₹11,958.56
You save:  ₹3,416.97
RM439.21
List Price:  RM614.91
You save:  RM175.70
₦161,317.86
List Price:  ₦225,851.46
You save:  ₦64,533.60
₨28,073.90
List Price:  ₨39,304.58
You save:  ₨11,230.68
฿3,339.06
List Price:  ฿4,674.82
You save:  ฿1,335.76
₺3,828.72
List Price:  ₺5,360.36
You save:  ₺1,531.64
B$572.08
List Price:  B$800.93
You save:  B$228.85
R1,857.55
List Price:  R2,600.64
You save:  R743.09
Лв171.49
List Price:  Лв240.10
You save:  Лв68.60
₩142,204.87
List Price:  ₩199,092.51
You save:  ₩56,887.63
₪366.59
List Price:  ₪513.24
You save:  ₪146.65
₱5,655.18
List Price:  ₱7,917.48
You save:  ₱2,262.29
¥14,198.32
List Price:  ¥19,878.22
You save:  ¥5,679.89
MX$1,953.70
List Price:  MX$2,735.25
You save:  MX$781.55
QR364.07
List Price:  QR509.71
You save:  QR145.64
P1,376.72
List Price:  P1,927.47
You save:  P550.74
KSh12,943.70
List Price:  KSh18,121.70
You save:  KSh5,178
E£5,094.13
List Price:  E£7,131.98
You save:  E£2,037.85
ብር13,446.70
List Price:  ብር18,825.91
You save:  ብር5,379.21
Kz91,690.83
List Price:  Kz128,370.83
You save:  Kz36,680
CLP$95,242.47
List Price:  CLP$133,343.27
You save:  CLP$38,100.80
CN¥731.15
List Price:  CN¥1,023.64
You save:  CN¥292.49
RD$6,020.55
List Price:  RD$8,429.01
You save:  RD$2,408.46
DA13,234.77
List Price:  DA18,529.21
You save:  DA5,294.44
FJ$225.30
List Price:  FJ$315.43
You save:  FJ$90.13
Q776.33
List Price:  Q1,086.89
You save:  Q310.56
GY$21,142.77
List Price:  GY$29,600.73
You save:  GY$8,457.95
ISK kr12,708.72
List Price:  ISK kr17,792.72
You save:  ISK kr5,084
DH928.92
List Price:  DH1,300.53
You save:  DH371.60
L1,718.78
List Price:  L2,406.37
You save:  L687.58
ден5,396.62
List Price:  ден7,555.49
You save:  ден2,158.86
MOP$805.16
List Price:  MOP$1,127.26
You save:  MOP$322.09
N$1,878.49
List Price:  N$2,629.97
You save:  N$751.47
C$3,709.18
List Price:  C$5,193
You save:  C$1,483.82
रु13,729.94
List Price:  रु19,222.47
You save:  रु5,492.52
S/373.49
List Price:  S/522.91
You save:  S/149.41
K416.97
List Price:  K583.78
You save:  K166.80
SAR375.05
List Price:  SAR525.09
You save:  SAR150.03
ZK2,869.58
List Price:  ZK4,017.53
You save:  ZK1,147.95
L436.50
List Price:  L611.12
You save:  L174.62
Kč2,193.75
List Price:  Kč3,071.34
You save:  Kč877.59
Ft35,836.25
List Price:  Ft50,172.18
You save:  Ft14,335.93
SEK kr958.55
List Price:  SEK kr1,342.01
You save:  SEK kr383.45
ARS$110,318.96
List Price:  ARS$154,450.96
You save:  ARS$44,132
Bs696.42
List Price:  Bs975.02
You save:  Bs278.59
COP$431,407.96
List Price:  COP$603,988.40
You save:  COP$172,580.44
₡50,669.87
List Price:  ₡70,939.85
You save:  ₡20,269.97
L2,580.74
List Price:  L3,613.14
You save:  L1,032.40
₲806,732.12
List Price:  ₲1,129,457.25
You save:  ₲322,725.12
$U4,215.14
List Price:  $U5,901.37
You save:  $U1,686.22
zł376.49
List Price:  zł527.11
You save:  zł150.61
Already have an account? Log In

Transcript

Hey guys welcome back. So in this video we're going to discuss another type of loops which is the do loop and the do loop has a general structure of do and then whatever code you need to be executed over and over again. And then the word loop However, if you use the do loop in this structure, the loop will just keep on getting executed over and over again and it will not stop unless you do something special, like use the exit do statement or use a go to statement or so this is why it's actually got two variations to our use usually, and these two variations are the due until and do while so the due until has a structure of do until condition is equal to two and then some code and then loop or alternatively it could be written as do and then code and then loop until condition is equal to true.

So actually on the do until whatever code you put in inside the loop will be just performed over and over again until a certain condition is true. So whenever that condition is satisfied and becomes true, the loop will cease to be executed, the loop will just end and you will exit the loop and perform whatever code is after the loop. And on the do while, as you can see here, it's got a structure of do while condition is equal to true and then the code and then loop or do and then the code and then loop while the condition is equal to true. So the do while structure will get whatever code you put in there performed over and over again, as long as a condition is true while a condition is true. So as long as this condition is true, the code is just going to be executed over and over again.

So this is the difference between to do while and to do until to do until it's performance Kill, a condition is true. And the do while is performed, while a condition is true, or as long as a condition is true. So if the condition turns out to be false on the do while the loop is just going to end and we will execute whatever code is after the loop. So what's the difference between the two variations on each structures? So what's the difference between the one on the left and the one on the right, for example? Well, the difference is on the one on the left here, that condition will be evaluated before the code is executed.

So we will not execute the code at all before evaluating the condition. However, on the one on the right, we could have at least one pass through the code before the condition is evaluated. And so in terms of performance, the variation on the left here can be faster than the one on the right because with the one on the left, you could have the condition be equal to true and not have to execute the code not have to do that one pass through the code. And this could save you time on your code. So the one on the left here could save you more time, in case the condition is evaluated to true before going through the code one time, and the same goes for the do while as well, on the do while the one on the left here can save you time as well because the condition is evaluated before the code is executed at least once.

So this can save you time as well. So this was a quick introduction about the doom loop on the upcoming videos. We're gonna go into more depth about the doom loop, and we're gonna see some examples as well. So thanks guys for watching this video and I'll see you on the next one.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.