how to model loop in another loop? Topic is solved

Problems with modeling
Post Reply
dasa
User
User
Posts: 13
Joined: 4 years ago

how to model loop in another loop?

Post by dasa »

Hello everyone,
could you please give me an idea to write loop in loop? is it correct to write as the code below?

Thanks,

Code: Select all

loop (it$((UB1-LB1)>TOL),
     loop (it$((UB-LB)>TOL),
     statement1
     statement2
);
);
User avatar
gamsadmin
Site Admin
Site Admin
Posts: 16
Joined: 7 years ago

Re: how to model loop in another loop?

Post by gamsadmin »

Hi
You could write this as one condition:

Code: Select all

loop (it$((UB1-LB1)>TOL and (UB-LB)>TOL)),
     statement1
     statement2
);
If you want to use two loops, you need to make an alias for it:

Code: Select all

alias(it, ait)
loop (it$((UB1-LB1)>TOL),
     loop (ait$((UB-LB)>TOL),
     statement1
     statement2
);
);
Cheers
Renger
dasa
User
User
Posts: 13
Joined: 4 years ago

Re: how to model loop in another loop?

Post by dasa »

Great. Thanks you so much.
gamsadmin wrote: 3 years ago Hi
You could write this as one condition:

Code: Select all

loop (it$((UB1-LB1)>TOL and (UB-LB)>TOL)),
     statement1
     statement2
);
If you want to use two loops, you need to make an alias for it:

Code: Select all

alias(it, ait)
loop (it$((UB1-LB1)>TOL),
     loop (ait$((UB-LB)>TOL),
     statement1
     statement2
);
);
Cheers
Renger
Post Reply