# Differences

This shows you the differences between two versions of the page.

— |
if [2019/07/01 14:25] (current) a.leofreddi created |
||
---|---|---|---|

Line 1: | Line 1: | ||

+ | ====== If ====== | ||

+ | The if function evaluates the given expression and returns the first value if true, else the second. | ||

+ | |||

+ | The ternary operator implementation is backed by an if call, so that ''a ? b : c'' is equivalent to ''if(a, b, c)''. | ||

+ | |||

+ | ===== Signature ===== | ||

+ | |||

+ | <code> | ||

+ | T if(Boolean expr, T first, T second) | ||

+ | </code> | ||

+ | //T is a type variable, so it can bind any type// |