In this lecture we will discuss more about Loop control.
- Switch – case commands
- Nested lops
- break command
- continue command
switch - case Command
There is no conditional statement used in this looping structure. It choose the code to be executed based on value of scalar or string, not just true/false. Different codes can be executed based on the value of the scalar defined in the switch command. The codes are defined using the case command.Nested Loop
A nested loop is a loop or conditional statement placed inside another loop or conditional statement. Simply, a loop within a loop. Both for and while loops can be nested.
The continue statement is used for passing control to next iteration of for or while loop. The continue statement in MATLAB works somewhat like the break statement. Instead of forcing termination, however, 'continue' forces the next iteration of the loop to take place, skipping any code in between.
break Statement
The break statement terminates execution of for or while loop. Statements in the loop that appear after the break statement are not executed. In nested loops, break exits only from the loop in which it occurs. Control passes to the statement following the end of that loop.
continue Statement
The continue statement is used for passing control to next iteration of for or while loop. The continue statement in MATLAB works somewhat like the break statement. Instead of forcing termination, however, 'continue' forces the next iteration of the loop to take place, skipping any code in between.
Thanks a lot for this suggest. I'm talking about numerous My partner and i tend to be ingenious in order to post. You nearly all drastically problem designed this site website influence one thing speciel. You clearly see that which you tend to be jaunty on, youve insured therefore numerous ladders. air conditioning repair in Kuwait
ReplyDelete