It’s a shorthand for writing this:

variable = if (input != null) input else default

This is equivalent:

variable = input ?: default
@AVincentInSpace@pawb.social
link
fedilink
English
2
edit-2
3d

Huh. Neat feature. That’s in C# I assume?

@dev_null@lemmy.ml
link
fedilink
2
edit-2
3d

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

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 159 users / day
  • 317 users / week
  • 704 users / month
  • 2.84K users / 6 months
  • 1 subscriber
  • 1.57K Posts
  • 34.8K Comments
  • Modlog