imantha
imantha

Reputation: 3838

Julia not operator

I am wondering if there is a way to use somesort of not operator with function such ismissing() or isempty() For example, if I want to do something like this, How would I go about it.

x = Array[]
y = missing

if x not isempty(x)
    # do something
elif not ismissing(y)
    # do something
end

This is of course incorrect, and an empty array can be solved with if length(x) >0. But I am wondering if there is a way to do using with not-operator like in python. For example, In python numpy library I can do something like this to achieve this,

y = np.nan
if y is not np.nan:
    #do something

Upvotes: 5

Views: 1969

Answers (1)

lungben
lungben

Reputation: 1158

This is the !(x) function, e.g. !ismissing(x).

Upvotes: 8

Related Questions