ener.hlp (Topic list)
WHILE without WEND (ERR: 29)
■ Each WHILE statement must have a matching WEND statement.
  For example:
 
              WHILE i% <> 0
                   PRINT i%
                   i% = (i% - 1)
                   WHILE x% <> 0
                        PRINT x%
                        x% = (x% - 1)
                   WEND
              WEND
 
■ Verify that other control structures within the WHILE...WEND
  structure are correctly matched. For example, an IF without
  a matching ENDIF inside the WHILE...WEND structure generates
  this error.
 
■ The DO...LOOP statement provides a more powerful and
  flexible loop control structure than WHILE...WEND.
 
■ If you need additional help, move the cursor to a keyword
  and press F1 to open the Help window.