QL add expression for alternative default value #5348
Marcono1234
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Now and then there are cases where an expression might not have a result and a default value is chosen instead. Such code typically looks like this
(please let me know if there is a better alternative)
This is error-prone because you have to write the expression which yields the result twice. Would it be possible to introduce a built-in
defaults(... | ...)
expression (or similar) which simplifies this? E.g.:It might also be useful to support an arbitrary number of alternative default values, each as fallback for the previous one, e.g.
defaults(first() | second() | third() | ...)
.Beta Was this translation helpful? Give feedback.
All reactions