![]() |
Macros - {WHILE} Loop Is Exited Prematurely |
The information in this document applies to:
WordPerfect® 5.1 for DOS
Problem
Symptoms: The customer is experiencing a problem when they try to use the {ON CANCEL}{GO}label~~ command to go out of a {WHILE} loop before the {WHILE} loop's expression is false. An example of how the user is setting up their {WHILE} loop, that the subroutine runs twice, is as follows: {ON CANCEL}{GO}abort~~ {ASSIGN}count~1~ {ASSIGN}key~~ {{WHILE}}{VARIABLE}count~>0~ {LOOK}key~ {VARIABLE}key~ {ASSIGN}count~{VARIABLE}count~+1~ {IF}{VARIABLE}count~=30~{GO}abort~{END IF} {STATUS PROMPT}{VARIABLE}count~~ {END {WHILE}} {LABEL}abort~ {STATUS PROMPT}~ {BELL}test Solutions: The customer shouldn't use a {GO} out of a {WHILE} loop unless they made the {WHILE} expression false or use {BREAK} to break out of the loop. When the program is instructed to go out of the {WHILE} loop, the program leaves the {WHILE} command on the stack, while the execution is at some other part of the macro not being looped in a {WHILE} loop structure. In other words, the problem is leaving the {WHILE} loop prematurely. This is before the {WHILE} loop's expression is false. In other languages, the user would receive a compilation warning when compiling their program. |
Answer:
Details:
Product specifications, packaging, technical support and information (*Specifications*) refer to theUnited States retail English version only. Specifications for other versions may vary. All Specifications, claims, features, representations, and/or comparisons provided are correct to the best of our knowledge of the date of publication, but are subject to change without notice.OUR MAXIMUM AGGREGATE LIABILITY TO YOU AND THAT OF OUR DEALERS AND SUPPLIERS IS LIMITED. IT SHALL NOTEXCEED THE AMOUNT YOU PAID TO ACCESS THE INFORMATION. SEE LEGAL DISCLAIMER. |