On Sat, 2011-01-01 at 10:55 -0600, Meketon, Marc wrote:
> Cool!  Thank you!  A bit of a kludge, but a lot better than my kludge.
> 
> 
> -----Original Message-----
> From: glpk xypron [mailto:[email protected]]
> Sent: Saturday, January 01, 2011 7:50 AM
> To: Meketon, Marc; [email protected]
> Subject: Re: [Help-glpk] Wish list - an extended "if then else" statement
> 
> Hello Marc,
> 
> > for{(time,ad) in EVENTS} {
> >   if ad='A' then printf "dual=%3g  %5d\n", ARRIVALS[time].dual, time
> >
> >   else printf "          %5d dual=%3g\n", time, DEPARTURES[time].dual;
> > }
> >
> > but that doesn't work.
> 
> This is the closest you can get with the existing syntax:
> 
> for{(time, ad) in EVENTS} {
>   printf{ i in {1} : ad == "A" }
>     "dual=%3g  %5d\n", ARRIVALS[time].dual, time;
>   printf{ i in {1} : ad != "A" }
>     "%5d dual=%3g\n", time, DEPARTURES[time].dual; }
> 
> Best regards
> 
> Xypron

Another, more general way to simulate the if-then-else statement

   if c then S1 else S2

is the following:

   for {0..0: c}
   {
      S1;
   }
   for {0..0: not c}
   {
      S2;
   }


_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to