REAL FUNCTION GETREAL ( LO , HI , DEFAULT , PROMPT ) REAL FUNCTION GETREAL1( DEFAULT , PROMPT ) REAL , INTENT(IN ) :: LO ! Minimum allowed return value REAL , INTENT(IN ) :: HI ! Maximum allowed return value REAL , INTENT(IN ) :: DEFAULT ! Default return value CHARACTER*(*), INTENT(IN ) :: PROMPT ! Prompt for user
Display thePROMPT
to standard output, get the user's response as aREAL
, and forGETREAL()
check that it is within rangee[LO,HI]
. ReturnDEFAULT
if the user hits <RET>. Reprompts on error for up to 5 attempts; exits in case of more than 5 entry errors. If environment variable PROMPTFLAG is set to "N", returnsDEFAULT
without prompting the user. Logs the value returned, for tracking and validation purposes.The default is displayed in square brackets at the end of the prompt
[LIKE THIS]
See also GETVAL(), GETDATE(), GETDBLE(), GETMENU(), GETNUM(), GETSTR(), and GETYN().
none
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 M3UTILIOGETREAL1
is for I/O API-3.2 and later, only.(See sample programs LATLON or PRESZ for additional usage examples.)
... USE M3UTILIO !! else: REAL, EXTERNAL :: GETREAL, GETREAL1 ... REAL X, Y, Z, W INTEGER N ... X = GETREAL( 0.0, 10.0, 7.5, 'Give me a (REAL) number between 0.0 and 10.0' ) Y = GETREAL1( 23.4, 'Give me a (REAL) number' ) Z = GETVAL( 12.3, 'Give me a (REAL) number' ) !! only if USE M3UTILIO N = GETVAL( 99, 'Give me a (INTEGER) number' ) !! only if USE M3UTILIO ...
Don't, unless you're already comfortable with mixed-language programming.
To: Models-3/EDSS I/O API: The Help Pages