Reputation: 18547
This is .mod (model file)
tuple TDayPair{
string day1;
string day2;
}
{TDayPair} DAYS={<"Mon","Tue">,<"Thurs","Fri">};
int a[DAYS]= ...;
execute {
writeln(a[<"Mon","Tue">]); //<--it gives syntax error here
}
This is .dat (data file)
a = #[
<"Mon","Tue">:1,
<"Thurs","Fri">:2,
]#;
It gives syntax error at the model file at writeln(a[<"Mon","Tue">]);
what's the issue here?
Upvotes: 1
Views: 137
Reputation: 10062
If you write
tuple TDayPair{
string day1;
string day2;
}
{TDayPair} DAYS={<"Mon","Tue">,<"Thurs","Fri">};
int a[DAYS]= ...;
execute {
writeln(a[DAYS.find("Mon","Tue")]); //<--it gives syntax error here
}
You will get
1
OPL Modeling language is not the same as the OPL Javascript language that helps with preprocessing, postprocessing and flow control.
Upvotes: 2