If VARIABLE != null

I’d like to run a section of a function only if a particular variable has a value stored in it, in other languages I might do something like…

if(variable != null){

}

But IF VARIABLE != NULL doesn’t seem to work here, and I can’t seem to figure out how to do this.

I’ve confirmed that if new_text == null works, but if new_text != null doesn’t

SOLVED

For a text variable it looks like I can’t use NULL, I replaced it with “” and it works fine

if VARIABLE != "":

That’s odd - I use != null a lot and it works. Perhaps it’s because a text field has an empty string by default and therefore isn’t technically null? but that’s just a guess.

That is indeed the case, thanks, Yann :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms