Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> vrange() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    VRANGE()

Purpose:     Numeric range validation with error handling.

Syntax:      VRANGE( value, lower, upper [, color ] )

Arguments:   value       - Numeric value to validate as being between the
                           <lower> and <upper> limits, inclusive.

             lower       - Numeric lower limit that <value> must be equal
                           to or greater for VRANGE() to return True.

             upper       - Numeric upper limit that <value> must be equal
                           to or less than for VRANGE() to return True.

             color       - Optional character color string to use when
                           displaying error messages.  If omitted or an
                           invalid parameter is passed, the default color
                           is Bright White on Red (W+/R) for color
                           monitors and High intensity for monochrome.

Returns:     True if <value> is between <lower> and <upper> inclusive.

Description: VRANGE() is a numeric function most often used within VALID
             clauses of GET statements.  Its best use is as a replacement
             for the limited RANGE clause.

             VRANGE() checks that <value> is greater than or equal to
             <lower> and that <value> is less than or equal to <upper>.
             If this is false, VRANGE() displays a SAYINBOX() error
             message (in the optional <color> specified) and waits for a
             confirming keypress for 10 seconds.  After 10 seconds,
             VRANGE() times out and returns False.

Notes:       If any of the first three arguments are either missing or
             non- numeric in type, VRANGE() will set the appropriate
             RLIBERROR() value and return False.

Example:     *-- prevent a negative age with a nice looking error message
             age = 0
             @ 10, 0 SAY "Enter your age:"
             @ 10,16 GET M->age PICTURE "##" ;
                VALID Vrange( M->age, 1, 99, "GR+/R" )
             READ

Source:      RL_VRANG.PRG

See also:    BOXASK(), NOTEMPTY(), SAYINBOX()

See Also: BOXASK() NOTEMPTY() SAYINBOX()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson