halubilo.social
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
@[email protected] to Programmer [email protected] • 8 months ago

Elvis

feddit.it

message-square
35
fedilink
151

Elvis

feddit.it

@[email protected] to Programmer [email protected] • 8 months ago
message-square
35
fedilink
  • @[email protected]
    link
    fedilink
    English
    2•7 months ago

    The second one isn’t valid syntax in any programming language I’m familiar with. What does it do?

    • @[email protected]
      link
      fedilink
      4•7 months ago

      It’s a shorthand for writing this:

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

      This is equivalent:

      variable = input ?: default
      
      • @[email protected]
        link
        fedilink
        English
        2•
        edit-2
        7 months ago

        Huh. Neat feature.

        • @[email protected]
          link
          fedilink
          2•
          edit-2
          7 months ago

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

Programmer [email protected]

[email protected]

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

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.
  • 149 users / day
  • 779 users / week
  • 2.97K users / month
  • 9.4K users / 6 months
  • 36.9K subscribers
  • 1.78K Posts
  • 38K Comments
  • Modlog
  • mods:
  • @[email protected]
  • @[email protected]
  • BE: 0.19.3
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org