nextc
A circular version of the function next
Purpose
OPL function.
A circular version of the function next.
| type |
|---|
int, float, string, or a tuple type |
Syntax
int nextc({int},int)
int nextc({int},int,int)
float nextc({float},float)
float nextc({float},float,int)
string nextc({string},string)
string nextc({string},string,int)
<tuple type> nextc({<tuple type>},<tuple type>)
<tuple type> nextc({<tuple type>},<tuple type>,int)
Description
nextc is a circular version of the function next and considers that the successor of the last
element of the type is the first element. You can use this function
within IBM ILOG Script statements by specifying the OPL namespace:
( Opl.xxx() )
Example
{string} Days ={"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
string n1 = nextc(Days,"Sunday");
string n2 = nextc(Days,"Sunday",3);
execute
{
writeln("nextc(Days,\"Sunday\") gives ",n1);
writeln("nextc(Days,\"Sunday\",3) gives ",n2);
}
Result
nextc(Days,"Sunday") gives Monday
nextc(Days,"Sunday",3) gives Wednesday