It’s a shorthand for writing this:
variable = if (input != null) input else default
This is equivalent:
variable = input ?: default
It’s a shorthand for writing this:
variable = if (input != null) input else default
This is equivalent:
variable = input ?: default
“Show all posts from newest to oldest” is an algorithm.
“Shows random 10 posts, unordered” is an algorithm.
It’s not possible to show a list of items without an algorithm. You may of course take issue with what the algorithm is, but you can’t not have one.
It’s a shorthand for writing this:
variable = if (input != null) input else default
This is equivalent:
variable = input ?: default
The answers confusing it with the ternary operator are wrong.
Because it’s not one. Ternary operator is A ? B : C, Elvis operator is A ?: B. The same two characters are involved, but both the syntax and effect is different.
Doubled down? After being called out they slowed the upload cadence, are taking more time to make sure mistakes don’t get through, and changed their production process. They also formed a volunteer team of “beta tester” viewers who see each video pre-release to catch any mistakes they didn’t internally. I think they handled it well. Of course it would be better if they didn’t have a problem in the first place, but I’d never call it “doubling down”.
It’s in Kotlin and some other languages. C# has it but there it’s actually
A ?? B
.