Put it in an if-else and it executes both blocks.
Fun fact I learned today - you know how when there’s a compound conditional, the interpreter stops once the result is known? (Eg, if the left side of an and is false, it’s false so it doesn’t bother checking the second condition)
Apparently, visual basic doesn’t do this thing every other language I know of does… It might be a debug only thing for the convenience of the depreciated ide I’m forced to use, but I did a null check && called a function on it if it’s not null, and it blew up
I pride myself on my ability to change to a new programming language and make progress on day one, but vb is truly the most disgusting POS language I’ve ever seen. From syntax to jarring inconsistencies in language design, it’s just gross
-
That’s behaviour that’s just part of language design. If you rely on it you should probably check how the language you’re using handles it.
-
relying on that behaviour sounds a lot like “clever” (read unnecessarily unreadable) code
-
But only if you don’t look
Schrödinger’s boolean
Known to cause heisenbugs. They’re bugs that disappear when you try to measure them with a debugger or a printf.