Description
Contributor: Alex
Small Model of Type : GAMS
Category : GAMS Test library
Main file : ifthen3.gms
$title Test $ifThen $elseIf/else $endIf (IFTHEN3,SEQ=453)
$onText
Contributor: Alex
$offText
scalar count / 0 /;
$ifThenE 1
display 'good ifthen 1'; count = count+1;
$elseIfE 1
abort 'bad elseif 1'
$elseIfE 1
abort 'bad second elseif 1'
$else
abort 'bad else 1'
$endIf
$ifThenE 1
display 'good ifthen 2'; count = count+10;
$elseIfE 0
abort 'bad elseif 2'
$elseIfE 1
abort 'bad second elseif 2'
$else
abort 'bad else 2'
$endIf
$ifThenE 0
abort 'bad ifthen 11'
$elseIfE 1
display 'good elseif 11'; count = count+100;
$elseIfE 1
abort 'bad second elseif 11'
$else
abort 'bad else 11'
$endIf
$ifThenE 0
abort 'bad ifthen 12'
$elseIfE 0
abort 'bad elseif 12'
$elseIfE 1
display 'good second elseif 12'; count = count+1000;
$else
abort 'bad else 12'
$endIf
$ifThenE 0
abort 'bad ifthen 13'
$elseIfE 0
abort 'bad elseif 13'
$elseIfE 0
abort 'bad second elseif 13'
$else
display 'good else 13'; count = count+10000;
$endIf
$ifThenE 0
abort 'bad ifthen 14'
$elseIfE 1
display 'good elseif 14'; count = count+100000;
$elseIfE 0
abort 'bad second elseif 14'
$else
abort 'bad else 14'
$endIf
abort$(count<>111111) count,'should be 111111';