Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - iifd() evaluate a conditional date expression http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 iifd()              Evaluate a conditional date expression
------------------------------------------------------------------------------
 Declaration
   system.hdr

 Syntax
   func date iifd extern
   param value logical lExpression, ;
         value date    dDateTrue, ;
         value date    dDateFalse

 Arguments
   lExpression is a conditional expression for evaluation.
   dDateTrue is the value to return if lExpression is true.
   dDateFalse is the value to return if lExpression is false.

 Return
   A date whose value depends on the result of conditional evaluation.

 Description
   The iifd() function evaluates lExpression and returns the date value
   supplied in either of the two alternative parameters, depending on the
   result of the conditional evaluation. Note that the function simply
   selects between the return values of the two alternative expressions,
   both of which are evaluated before the call.

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   // Change computer's date if supplied date is valid
   
   proc Test_iifd
   vardef
      date dDateTrue
      date dDate
   enddef
   dDateTrue := today()            // save current date
   @ 10, 10 say "Change date to" get dDate
   read
   settoday( iifd( verifydate( dDate ), dDate, today() ) )
   ? "Date changed to", today()
   wait
   settoday( dDateTrue )           // reset correct date
   endproc

   proc main
   Test_iifd()
   endproc

See Also: if

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