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.