lines 726-825 of file: lib/cplusplus/a_double.cpp {xrst_begin a_double_cond_assign} AD Conditional Assignment ######################### Syntax ****** | *target*\ ``.cond_assign`` ( *cop* , *left* , *right* , *if_true* , *if_false* ) Purpose ******* The code | |tab| ``if`` ( *left* *cop* *right* ) | |tab| |tab| *target* = *if_true* | |tab| ``else`` | |tab| |tab| *target* = *if_false* records either the true or false case depending on the value of *left* and *right* ; see :ref:`cpp_fun_ctor-name`. If *left* or *right* is a :ref:`variable`, it may be desirable to switch between *if_true* and *if_false* depending of the value of the independent variable during calls to order zero :ref:`cpp_fun_forward-name`. The ``cond_assign`` does this. target ****** This object has c++ prototype | |tab| ``a_double&`` *target* cop *** This argument has c++ prototype | |tab| ``const char *cop`` The comparison is | |tab| *left* *cop* *right* where *cop* is one of the following: .. csv-table:: :widths: 10, 10 *cop* , ``<`` , less than ``<=`` , less than or equal ``==`` , equal ``>=`` , greater than or equal ``>`` , greater than left **** This argument has c++ prototype | |tab| ``const a_double&`` *left* It specifies the left operand in the comparison. right ***** This argument has c++ prototype | |tab| ``const a_double&`` *right* It specifies the right operand in the comparison. if_true ******* This argument has c++ prototype | |tab| ``const a_double&`` *if_true* It specifies the value assigned to *ad* if the result of the comparison is true. if_false ******** This argument has c++ prototype | |tab| ``const a_double&`` *if_false* It specifies the value assigned to *ad* if the result of the comparison is false. {xrst_toc_hidden example/cplusplus/a_double_cond_assign_xam.cpp example/python/core/a_double_cond_assign_xam.py } Example ******* :ref:`c++`, :ref:`python`. {xrst_end a_double_cond_assign}