What does this line of code mean? label.frame = (inPseudoEditMode) ? kLabelIndentedRect : kLabelRect; The ? and : confuse me. 13 Answers 13
Can I write the if else shorthand without the else? var x=1; x==2 ? dosomething() : doNothingButContinueCode(); I’ve noticed putting null for the ...
-
May 17, 2022
- 0 Comments
How is the conditional operator (? :) used in Ruby? For example, is this correct? <% question = question.size > 20 ? question.question.slice(0, ...
-
May 15, 2022
- 0 Comments
I saw this today in some PHP code: $items = $items ?: $this->_handle->result('next', $this->_result, $this); I’m not familiar with the ?: operator being ...
-
May 15, 2022
- 0 Comments
How can I use an inline if statement in JavaScript? Is there an inline else statement too? Something like this: var a = ...
-
May 12, 2022
- 0 Comments
In C/C++ (and many languages of that family), a common idiom to declare and initialize a variable depending on a condition uses the ...
-
May 4, 2022
- 0 Comments
In Perl (and other languages) a conditional ternary operator can be expressed like this: my $foo = $bar == $buz ? $cat : ...
-
May 4, 2022
- 0 Comments
Can someone explain the differences between ternary operator shorthand (?:) and null coalescing operator (??) in PHP? When do they behave differently and ...
-
May 4, 2022
- 0 Comments
In simple words, what is the ?: (conditional, “ternary”) operator and how can I use it? 19 s 19 This is a one-line ...
-
May 3, 2022
- 0 Comments