The following program segment uses CERROR( ) in a DO WHILE loop to make the user edit the program until it compiles successfully:

DO WHILE .T.
  Clear
  MODIFY COMMAND USER.PRG
  ON ERROR ? ERROR(), MESSAGE(), CERROR()
  COMPILE USER.PRG
  IF CERROR( )>0
     ?
     WAIT "Your program didn't compile. Press a key to edit your .PRG."
     LOOP
  ELSE
     EXIT
  ENDIF
ENDDO