Evaluates z for each value of the iteration variable x over the range y. Typically, at least one expression in the loop body, z, uses the value of x to change the calculation for each evaluation.
Operands
• x is any valid variable name.
• y is a value or sequence of values. Most frequently, y is a range variable, but you can also use a vector, or a comma-separated list of scalars or vectors, each of which results in a series of scalar values that x assumes in turn. To apply the same calculation to a set of matrices, you can define y to be a series of matrices separated by commas.
• z is any valid expression or sequence of expressions. For example, a local assignment or a sequence of programming steps is allowed.
Additional Information
• You can type the word for and then press Ctrl+J to convert the word to a programming operator with all its placeholders.
• Use a for loop when you know exactly how many times you want the body of the loop to execute.
• You may want to exit a loop before its termination condition is met or to skip a particular iteration and proceed to the next one. You can control the execution of a loop by using the break and continue operators.