Conditional(ternary) operators
Conditions are evaluated sequentially.
First check if debtAmount == 0, if so, return TRUE. If debtAmount does not equal to 0 (FALSE), proceed to evaluate 2nd conditional.
Second conditional checks that debtAmount is less than the max possible debt a user can take on given their deposits.
If second conditional evaluates to be true, TRUE is returned.
Else, FALSE is returned.
Essentially, the common short-circuiting rules would apply with the use of the || operator - such that if the first conditional is successfully evaluated to be true, subsequent conditionals will not be evaluated. (edited)
if condition true ? then A : else B
Evaluates the expression first then checks the condition for return values corresponding to true or false.
Example:
Further reading
Last updated