Hello and welcome to goal and programming language course.
In the previous session, we talked about for loop as via loop, and in this session we want to talk
about the others loops and control statements.
Loop control statements in gold language loop control statements.
Change and execution from its normal sequence when an execution leaves its scope.
All automatic objects that were created in debtor's school are destroyed.
The gold language supports three types of loop control statements.
Break a statement.
Continue the statement and go to a statement.
Break a statement, the break is statement and go programming language has the following two usages.
First, when a break, a statement is encountered inside the loop, the loop is immediately terminated
and the program control resumes at the next the statement following the loop.
Second, it can be used to terminate a chase in such a statement.
If you are using nested loops, the break a statement will stop the execution of the innermost Luke
in a start executing the next line of code after the block.
Now you can see the syntax.
Let's go to this school program to illustrate how to use a public statement.
First, define a for loop and print zero on for solving right, for defining a variable.
I call them equals and initialize it by zero value semicolon set condition.
I less than five and set increments.
All right.
I + + open and curly braces and write our statements here.
In this case, we want to display our variable value.
So bright FP I.
Now define that look breaks, then the value of I equals three.
So go to the next line, define the condition if I equals equals three.
So you want to set that break a statement?
OK.
Reformat the call, save the project and execute the program.
So go to terminal and run the program by the comment go round thoughts back.
Is this mean that go?
Now we can see the output in this example.
We defined the for loop that is thought from zero until as long as I is less than five and one unit
is added to the variable I each time and preen the value of I variable and defined the break point where
I equals three.
So then I variable values three for looking broken so we can no longer display the value four and the
program exit from the bloc in order not to prolong the time of decision.
We will finish it and we will continue the content in the next session.
Goodbye.