This chapter gives some examples of flow control as well as ways to do the examples using indexing. The first example uses nested for loops and if/else statements. The second example uses the while statement. The third example is of nested for loops. The fourth example uses a for loop, an if statement, and a next statement. The fifth example is of a for loop, a repeat loop, an if statement, and a break statement.
Nested ‘for’ Loops with an ‘if/else’ Statement
In this example, we do an element-by-element substitution into a matrix based on an if/else test.
First, a two-by-five ...