s

    SiebelsTim

    3 years ago
    The same is true about when: The closest supertype of String, String and Nothing is Nothing?
    It should be String, String and Nothing? -> String?, right?
    marcinmoskala

    marcinmoskala

    3 years ago
    ow, yes
    Pavlo Liapota

    Pavlo Liapota

    3 years ago
    And in the summary:
    Non-nullable type is a supertype of the nullable one
    Should be other way around.
    When function declares Nothing as a return type, it means that it will throw an error
    Not necessary. You can also declare function with
    Nothing
    return type and have an infinite loop inside.
    When an expression declares Nothing as a return type, everything surely executed after that will be unreachable
    I would not say everything here. If this expression is inside
    try-catch
    block, then everything after this block is reachable. Also
    continue
    and
    break
    expressions return
    Nothing
    too, but only code after them and until loop’s end is unreachable.
    Dico

    Dico

    3 years ago
    @Pavlo Liapota I think the nullable type is a super type of the non null type. You cant assign a null value to a non-null typed variable, thus, the non-null has to be the subtype.
    Why would it be the other way around?
    Pavlo Liapota

    Pavlo Liapota

    3 years ago
    Yes, nullable type is a super type and the article in the summary states other way around.
    Dico

    Dico

    3 years ago
    Ok
    marcinmoskala

    marcinmoskala

    3 years ago
    Thanks @Pavlo Liapota Good points 🙂