|
$Eval |
Top Previous Next |
|
This evaluates a numerical expression at compile time and places it into a scoped control variable. In turn one can use $ife to do numeric testing on the value of this variable.
The format is $Eval expression
The expression must consist of constants, functions or other control variables with numerical values. The following GAMS date and release functions may also be used: jdate, jtime, gyear, gmonth, gday, gdow, gleap, ghour, gminute, gsecond, gmillisec, jstart, jnow, gamsversion, and gamsrelease Example: $set znumber 4 $Eval anumber %znumber%+10 $ife %anumber%>14 display "it exceeds 14" "%anumber%" $ife %anumber%<14 display "it is less than 14" "%anumber%" $ife %anumber%=14 display "it equals 14" "%anumber%" $ife %anumber%<>14 display "it does not equal 14" "%anumber%" Notes:
$EvalLocal that works with local control variables $EvalGlobal that works with global control variables
OR XOR EQV IMP AND NOT < <= = <> >= > LE LE EQ NE GE GT + - binary and unary * / ^ **
abs ceil cos errorlevel exp fact floor frac gamsrelease gamsversion gday gdow ghour gleap gmillisec gminute gmonth gsecond gyear IfThen jdate jnow jobhandle jobkill jobstatus jobterminate jstart jtime log log2 log10 max min mod PI power round sign sin sleep sqr sqrt tan trunc
|