
NULL vs. Empty Strings – Why Oracle Was Right and Apple Is Not - rusk
https://josjong.com/2017/10/16/null-vs-empty-strings-why-oracle-was-right-and-apple-is-not/
======
whipoodle

        if (!myString) {
        }
    

Good old JavaScript.

~~~
rusk
yeah I think actually python and ruby do this as well …

~~~
whipoodle
Pretty sure an empty string is truthy in Ruby.

~~~
rusk
Yes you're right. Ruby actually supports the comparison the author seeks [0]:

    
    
        > nil.to_s == ""
        > "".to_s == ""
    

[0] [https://stackoverflow.com/a/9915384](https://stackoverflow.com/a/9915384)

~~~
whipoodle
I think it might be more idiomatic, and more in the direction of what the
author seeks, to check `my_string.present?` which is false for nil and empty
string.

~~~
rusk
That's what they are. Pick one and invert the logic.

