Break Statement

2 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
€93.69
List Price:  €131.17
You save:  €37.48
£77.60
List Price:  £108.65
You save:  £31.04
CA$139.29
List Price:  CA$195.02
You save:  CA$55.72
A$151.87
List Price:  A$212.63
You save:  A$60.75
S$133.13
List Price:  S$186.38
You save:  S$53.25
HK$777.29
List Price:  HK$1,088.24
You save:  HK$310.95
CHF 87.93
List Price:  CHF 123.11
You save:  CHF 35.17
NOK kr1,104.77
List Price:  NOK kr1,546.73
You save:  NOK kr441.95
DKK kr698.68
List Price:  DKK kr978.18
You save:  DKK kr279.50
NZ$167.57
List Price:  NZ$234.61
You save:  NZ$67.03
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳12,019.14
List Price:  ৳16,827.28
You save:  ৳4,808.14
₹8,437.49
List Price:  ₹11,812.83
You save:  ₹3,375.33
RM440.95
List Price:  RM617.35
You save:  RM176.40
₦168,038.19
List Price:  ₦235,260.19
You save:  ₦67,222
₨27,930.87
List Price:  ₨39,104.34
You save:  ₨11,173.46
฿3,435.35
List Price:  ฿4,809.63
You save:  ฿1,374.28
₺3,432.75
List Price:  ₺4,805.99
You save:  ₺1,373.23
B$578.39
List Price:  B$809.77
You save:  B$231.38
R1,775.91
List Price:  R2,486.34
You save:  R710.43
Лв183.06
List Price:  Лв256.30
You save:  Лв73.23
₩139,696.36
List Price:  ₩195,580.49
You save:  ₩55,884.13
₪373.04
List Price:  ₪522.27
You save:  ₪149.23
₱5,864.11
List Price:  ₱8,209.99
You save:  ₱2,345.87
¥15,367.99
List Price:  ¥21,515.80
You save:  ¥6,147.81
MX$2,036.44
List Price:  MX$2,851.10
You save:  MX$814.65
QR365.08
List Price:  QR511.13
You save:  QR146.04
P1,334.01
List Price:  P1,867.67
You save:  P533.65
KSh12,898.71
List Price:  KSh18,058.71
You save:  KSh5,160
E£4,921.85
List Price:  E£6,890.79
You save:  E£1,968.94
ብር12,453.44
List Price:  ብር17,435.32
You save:  ብር4,981.87
Kz91,125.91
List Price:  Kz127,579.93
You save:  Kz36,454.01
CLP$97,077.66
List Price:  CLP$135,912.62
You save:  CLP$38,834.95
CN¥719.49
List Price:  CN¥1,007.32
You save:  CN¥287.82
RD$6,057.20
List Price:  RD$8,480.32
You save:  RD$2,423.12
DA13,406.48
List Price:  DA18,769.61
You save:  DA5,363.12
FJ$225.25
List Price:  FJ$315.36
You save:  FJ$90.11
Q777.28
List Price:  Q1,088.22
You save:  Q310.94
GY$21,042.91
List Price:  GY$29,460.92
You save:  GY$8,418
ISK kr13,914.60
List Price:  ISK kr19,481
You save:  ISK kr5,566.40
DH993.26
List Price:  DH1,390.60
You save:  DH397.34
L1,803.93
List Price:  L2,525.57
You save:  L721.64
ден5,764.94
List Price:  ден8,071.14
You save:  ден2,306.20
MOP$805.37
List Price:  MOP$1,127.55
You save:  MOP$322.18
N$1,760.19
List Price:  N$2,464.34
You save:  N$704.14
C$3,701.17
List Price:  C$5,181.79
You save:  C$1,480.61
रु13,577.81
List Price:  रु19,009.47
You save:  रु5,431.66
S/377.27
List Price:  S/528.20
You save:  S/150.92
K403.78
List Price:  K565.32
You save:  K161.53
SAR375.56
List Price:  SAR525.80
You save:  SAR150.24
ZK2,738.35
List Price:  ZK3,833.81
You save:  ZK1,095.45
L466.14
List Price:  L652.62
You save:  L186.47
Kč2,371.47
List Price:  Kč3,320.16
You save:  Kč948.68
Ft38,315.49
List Price:  Ft53,643.23
You save:  Ft15,327.73
SEK kr1,086.64
List Price:  SEK kr1,521.34
You save:  SEK kr434.70
ARS$99,364.60
List Price:  ARS$139,114.41
You save:  ARS$39,749.81
Bs696.54
List Price:  Bs975.19
You save:  Bs278.64
COP$434,893.49
List Price:  COP$608,868.29
You save:  COP$173,974.79
₡51,449.82
List Price:  ₡72,031.81
You save:  ₡20,581.98
L2,537.81
List Price:  L3,553.04
You save:  L1,015.22
₲786,505.60
List Price:  ₲1,101,139.31
You save:  ₲314,633.70
$U4,173.81
List Price:  $U5,843.51
You save:  $U1,669.69
zł406.70
List Price:  zł569.40
You save:  zł162.69
Already have an account? Log In

Transcript

Hello, in this video we are going to cover the break statement. So this is in relation to basically any type of loop, I will be using the for loop as an example. But you can implement this in any loop. So the break statement basically just exits out of the for loop and continues with the rest of the code. But we have this right here, and we're doing 0123456789. And maybe if there's a certain condition that is met, then we can we no longer want or less than the rest of the loop to run.

So for example, if let's say we have some input from the user, maybe this is the no selection. And let's say the selection is menu and if the Select selection equals menu can add multiple conditions and dollar i is equal to five, then we basically want to exit out of here, and all you do is put a break. And that's it. So if we run this now, we get 01234. So once he hits four, he goes through here, Echo zero, then four is incremented to five, and he goes here, and selection equals menu that doesn't change. So that's always true.

But it requires this condition to be true as well. Which means if I five, which it isn't there any breaks and break just means exit out of the for loop, and they exit and then to show you that the rest of the code is still running, I'm going to say and of code right here. As you can see, that piece of code is not altered by the break statement. And that's it. That's all you You need to know regarding the break statement if you have any questions, feel free to pop me a message. And as usual, I look forward to seeing you in the next video.

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.