• dev_null@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    4 days 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.