8.6.11.1 Ask Command

Syntax

ask expression as data_type to variable [required]

Description

The ask command writes expression on standard output as a prompt, reads a value of the specified data_type from standard input and assigns it to the name variable. The value read from standard input must match the specified data type; otherwise, the user is reprompted for the value. If the required option is used, a response is required; otherwise, a response of only a return/line feed is valid.

Table 8-21 describes the valid data types.

Table 8-21: Data Types

boolean Any of yes, y, no, or n, upper or lower-case.

date A valid date in one of the following formats: mmddyy, mm/dd/yy, mm.dddd-yy, mmddyyyy, mm/dd/yyyy, mm.dd.yyyy, or mm-dd-yyyy.

integer Any integer.

money A money value, with 2 decimal places assumed.

real Any decimal number.

string Any string of characters.

time A valid time in one of the following formats: hh, hhmm, hhmmss, hh:mm, or hh:mm:ss, optionally followed by am or pm.

The built-in ask command is only available when menu has the built-in menu commands enabled.

Examples

ask "Enter the report file name" as string to rptname

ask "Delete $fname (y/n)?" as boolean to answer

ask "Enter report date" as date to rptdate required