PickValid

Description:              This function attempts to return a valid value given a list of parameters.

Returns:                    Varies

Usage:                       Script or steady State

Format:                      PickValid(Parm1, Parm2 [, Parm3, ...])

Parameters:             Parm1, Parm2, Parm3...    { varies }  { required }  { no default: }

                                      Are any number of parameters giving any expressions, from which the first valid value will be selected.

Comments:               This function continues its search through its parameter list in order until the first valid value is found.

Examples:

a = Invalid;

b = 83;

c = Invalid;

d = -1;

validAns1 = PickValid(a, b, c, d);

validAns2 = PickValid(a, c, d, b);

The value of validAns1 and validAns2 will be 83 and -1 respectively. A typical use for this function is in setting default values as follows:

MyEditfield

(

  left; 

)

SetDefaults

[

  If 1 Main; 

  [ 

    left = PickValid(left, 100); 

  ] 

]

...

Given that module MyBox draws a box in the window, adding the PickValid statement ensures that even if an invalid value is given as a parameter, the box will still be displayed, because its invalid parameter will have been replaced with the default value.

See Also:

Valid