Error, invalid loop
|
Description
|
|
In Maple, for loops and while loops must be terminated with (or ). This error occurs when there is no end do or od statement to terminate the loop.
|
|
Examples
|
|
Example 1
In the following example, the for loop contains only a controlling clause, and does not contain an end do or od statement to terminate the loop.
>
|
|
Solution:
Complete the statement and add end do or od to the end of the loop.
>
|
|
| (2.1) |
Example 2
The following example contains a loop that is intended to return a floating-point approximation to the sine function at the angles (measured in degrees) in the list L. However, pressing Enter to insert line breaks (and not Shift + Enter) after the controlling clause in the for loop generates an error.
>
|
|
>
|
|
Solution
To correct this error, press Shift + Enter to insert line breaks within the loop body instead of simply pressing Enter. Terminate the for loop with either an end do or an od statement.
>
|
|
>
|
|
| (2.2) |
|
|
Download Help Document
Was this information helpful?