78

Explaining the difference between these two using Null && 0

Comments
  • 17
    Both have the sugar as array of little sugar crystals.
    The diet one has assigned null to the array.
    The zero one has set array’s size to 0.

    In conclusion the diet coke is more memory effective.
  • 1
    int cocaColaZero

    Vs

    int? dietCoke
  • 0
    If you add sugar to the one with zero sugar, it has one sugar.

    If you add sugar to the one with no sugar, the can melts.
  • 0
    Like shooting yourself in the foot
  • 1
    #define NULL 0
  • 0
    @just-basic-user But coke zero is type safe for functions which don't accept optionals. And how to implement pepsi max? sum([-∞..∞])?

    I feel like this is going to be the new tabs vs spaces.
  • 0
    @bittersweet Why can’t the sugar be optional array like “var sugar: [Sugarcrystal]? = [Sugarcrystal]()”
Add Comment