What is a Question Mark “?” and Colon “:” Operator Used for? [duplicate]

This is the ternary conditional operator, which can be used anywhere, not just the print statement. It’s sometimes just called “the ternary operator”, but it’s not the only ternary operator, just the most common one. Here’s a good example from Wikipedia demonstrating how it works: A traditional if-else construct in C, Java and JavaScript is … Read more

CSS “and” and “or”

&& works by stringing-together multiple selectors like-so: <div class=”class1 class2″></div> div.class1.class2 { /* foo */ } Another example: <input type=”radio” class=”class1″ /> input[type=”radio”].class1 { /* foo */ } || works by separating multiple selectors with commas like-so: <div class=”class1″></div> <div class=”class2″></div> div.class1, div.class2 { /* foo */ }

Unique ways to use the null coalescing operator [closed]

Well, first of all, it’s much easier to chain than the standard ternary operator: string anybody = parm1 ?? localDefault ?? globalDefault; vs. string anyboby = (parm1 != null) ? parm1 : ((localDefault != null) ? localDefault : globalDefault); It also works well if a null-possible object isn’t a variable: string anybody = Parameters[“Name”] ?? … Read more