5 ms·
Off the top of my head, I can't think of any language where "null" == null
by rootlocus 9y ago
Off the top of my head, I can't think of any language where "null" == null
- maze-le 9y agoI can think of a badly designed database interface. All SQL databases handle NULL as a special value, that cannot be compared by equality. But if you want compare the return value of a sql prompt in some language you can make a fallacy like: sqlstring = "SELECT 1 = NULL;" returnValue = callDB(sqlstring) if returnValue == "NULL" // here you go... end A solution would be to let the database handle NULL-values: sqlstring = "SELECT 1 IS NULL;"
- mikeash 9y agoBut can you think of any programmers clueless enough not to realize that there's a built in null value, and use the string "null" instead?
- ygra 9y agoIn Java at least, appending a null reference to another string will append "null": "" + null == "null"
- wtracy 9y agoIt happens pretty quickly once you start producing database queries by manually concatenating strings, or manually parsing database response strings.