Lesser Known Operators: Conditional (?:)
Tuesday, July 11th, 2006Operators are elements in a programming language that combine, compare, or change values in an expression. Common operators, such as < (less than) and > (greater than) are familiar to most developers. Those, for example, are relational operators; they compare two values and return a Boolean (true or false) that describes the relationship between them (A is greater than B or it isn’t). Other common relational examples include <= (less than or equal to) and >= (greater than or equal to).
Of the various categories of operators — relational is one of many — there are a handful that are undeniably lesser known. One of those is the conditional operator (?:), so let’s take a look at what it has to offer. Keep reading »




