GETYN()

Fortran version:

    LOGICAL FUNCTION GETYN( PROMPT , DEFAULT )
        CHARACTER*(*), INTENT(IN   ) :: PROMPT  ! Prompt for user
        LOGICAL      , INTENT(IN   ) :: DEFAULT ! Default return value

NO C version:

Summary:

Display the PROMPT to standard output for YES or NO, get the user's response and check that its first character, after upcasing, is 'Y' or 'N'. If 'Y', returns TRUE; if 'N', FALSE. Return DEFAULT if the user hits <RET>. Re-prompts on error for up to 5 attempts; exits in case of more than 5 entry errors. If environment variable PROMPTFLAG is set to "N", returns DEFAULT without prompting the user. Logs the value returned, for tracking and validation purposes.

The default is displayed in square brackets like this: [Y].

See also GETVAL(), GETDATE(), GETDBLE(), GETMENU(), GETNUM(), GETREAL(), and GETSTR().

Preconditions:

none

Fortran Usage:

GETVAL() is the Fortran-90-generic (I/O API-3.2 or later only) that calls these or various other similar routines, as determined by the argument-list.

For Fortran-90 declarations and interface checking:

    USE M3UTILIO
    

(See sample programs LATLON or PRESZ for additional usage examples.)

    ...
    USE M3UTILIO    !! else:  LOGICAL, EXTERNAL :: GETYN
    ...
    LOGICAL     L
    INTEGER     N
    ...
    L = GETYN( 'Give me a YES or NO', .TRUE )
    ...
    IF ( .NOT. GETYN( 'Continue?', L ) ) CALL M3EXIT( 0 )
    ...
    L = GETVAL( 'YES or NO?', .TRUE )       !!  only if USE M3UTILIO
    N = GETVAL( 99, 'Give me an INTEGER' )  !!  only if USE M3UTILIO
    ...

C Usage:

Don't, unless you're already comfortable with mixed-language programming.


Previous: GETSTR

Next: GRIDOPS

Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages