In if
statements, I am used to seeing x != null
, and reading it as "x is not null".
But in function names, having to say 'NotNull' or 'IsNotNull' to explain a similar state feels overly complicated. Not only because it is two or three words, but it also comes with the feeling of being a double negative used to express a positive concept.
What is a good word, hopefully not a long or compound word, which means the same as 'not null'?
Some ideas I've already brainstormed and rejected, and why:
"Initialized" would not be great because in most programming languages you can can initialize a variable to be null.
"something" might imply "not nothing", and so "not null" to you, but other people's interpretation may differ...
If there is no such word, then you can create one - your suggestions are welcome and I'm sure people will love to vote on their favorites.
In PHP there is a function named isset
- I think there's no shorter version than this.
It is based on your preference I think, isset / is / set / exist / has / ...
But don't you think code readability is more important to understand and write, instead of shortening every word
VALUED
The caveat here is NULL may be considered a value in some languages, so universal use of VALUED as the antithesis of NULL is not appropriate.
In PHP however, VALUED cleanly opposes NULL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With