Monday, December 12, 2011

What is the difference between a loop control variable and the loop body?

specifically for use in Matlab, an example would be very helpful. Either way, a general explanation would still help|||In general (I know nothing about Matlab), a loop control variable is the variable that counts the number of iterations of the loop and is used to determine when enough have been done (termination condition).





The loop body is the set of instructions the loop performs to accomplish something.





Hope that helps.|||In general,


a loop control variable is the variable that controls the execution of a loop. This variable helps the loop to repeat. It repeats the loop till the given condition is true





loop body is the work that you want to repeat





eg to print your name 10 times,





loop control variable would be the variable that would allow you to print your name 10 times


loop body would contain printing of your name

No comments:

Post a Comment