• nyan@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    Exactly. Most languages I know of that allow this at all will coerce the “1” to an integer and give x = 2. They get away with this because they define the “+” operator as taking numbers only as arguments, so if you hand them x = x + "cheese" they’ll error out.