• dev_null@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    3 hours ago

    It’s a shorthand for writing this:

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

    This is equivalent:

    variable = input ?: default
    

    The answers confusing it with the ternary operator are wrong.