πŸ‘½ dev_null (dev_null@lemmy.ml)

Joined: 2024-01-07

────

2024-11-21 dev_null ┃ edited ┃ RE: AVincentInSpace

It’s in Kotlin and some other languages. C# has it but there it’s actually A ?? B.

2024-11-21 dev_null ┃ 1πŸ’¬ ┃ RE: AVincentInSpace

It’s a shorthand for writing this:
[…]
variable = if (input != null) input else default
[…]

────

2024-11-20 dev_null ┃ edited ┃ RE: Cube6392

It’s a shorthand for writing this:
[…]
variable = if (input != null) input else default
[…]

2024-11-20 dev_null ┃ edited ┃ 1πŸ’¬ ┃ RE: AVincentInSpace

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.

────

πŸ“‘ Local feed

πŸ•οΈ Communities

πŸ”₯ Hashtags

πŸ”Ž Search posts

πŸ”‘ Sign in

πŸ“Š Status

πŸ›Ÿ Help