[#106355] [Ruby master Bug#18373] RBS build failure: '/include/x86_64-linux/ruby/config.h', needed by 'constants.o'. — "vo.x (Vit Ondruch)" <noreply@...>
Issue #18373 has been reported by vo.x (Vit Ondruch).
28 messages
2021/12/01
[ruby-core:106866] [Ruby master Feature#18332] a ? b
From:
"joelb (Joel Blum)" <noreply@...>
Date:
2021-12-28 14:48:29 UTC
List:
ruby-core #106866
Issue #18332 has been updated by joelb (Joel Blum).
If we adopt this syntax it might be worthwhile to consider JS new colaescing operator which does the same thing, maybe it's better to keep the syntax similar to JS. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator.
So basically just
a ?? b
----------------------------------------
Feature #18332: a ? b
https://bugs.ruby-lang.org/issues/18332#change-95677
* Author: dorianmariefr (Dorian Mari辿)
* Status: Open
* Priority: Normal
----------------------------------------
It would be a shortcut for `a ? b : nil`:
e.g.
```
"#{current_path == "/" ? "font-bold"}"
"#{user.admin? ? "text-red-600"}"
```
Doing `a && b` returns `false` which converted to a string gives `"false"`.
When `nil` converts to a string it gives `""`.
I would use it mostly in string interpolations.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>