12.07.2015 Views

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Logical operatorsThe following Boolean operators are available.Note: For C/C++ programmers: These operators are the same as in C and C++.Logical operatorsSyntax! booleanexp1 && exp2EffectLogical negation.Examples:! true -> false ! false -> trueReturns true if both Boolean expressions exp1 and exp2 are true. Otherwise,returns false.If exp1 is false, this expression immediately returns false without evaluatingexp2, so any side effects of exp2 are not taken into account.Examples:true && true -> true true && false -> false false && whatever -> false; whatever isnot evaluated.exp1 || exp2Returns true if either Boolean expression exp1 or exp2 (or both) is true.Otherwise, returns false.If exp1 is true, this expression immediately returns true without evaluating exp2,so any side effects of exp2 are not taken into account.Examples:false || true -> true false || false -> false true || whatever -> true; whatever is notevaluated.condition ? exp1 :exp2If condition is true, this expression returns exp1 ; otherwise, it returns exp2.When condition is true, the expression exp2 is not evaluated, so any sideeffects it may contain are not taken into account. Similarly, when condition isfalse, exp1 is not evaluated.Examples:true ? 3.14 : whatever -> 3.14 false ? whatever : "Hello" -> "Hello"I L O G O P L D E V E L O P M E N T S T U D I O L A N G U A G ER E F E R E N C E M A N U A L235

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!