• dev_null
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 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.