MAINSAIL Language Manual, Section 32.52

previous   next   top   contents   index   framed top   this page unframed


32.52. confirm

Figure 32–51. confirm
BOOLEAN
PROCEDURE   confirm     (OPTIONAL STRING msg,val);

confirm gets a yes-no confirmation from cmdFile.

msg is first written to logFile. If val is not "", it is written to logFile, preceded by a blank. Then (Yes or No): is written to logFile. The user may respond with yes (or y) for yes, no (or n) for no (case is not distinguished), or ? for a help message. confirm returns TRUE if the response is yes, FALSE if the response is no, and reprompts if the response is ?.

In the following code:

IF confirm("OK to delete",f.nameTHEN ...

if the user types y<eol> or Y<eol>, TRUE is returned. If the user types n<eol> or N<eol>, FALSE is returned. Otherwise, a message is written to logFile, and the user is reprompted until a valid response is obtained. The following is written to logFile if f.name = "WORKSHEET":

OK to delete WORKSHEET (Yes or No):

previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 32.52