Jump to content
Sign in to follow this  
aseliot

Uncreated task type?

Recommended Posts

So i have task05 which has not been made yet, i tried to do;

if(isNull task05) then {...};

this doesnt work. when printing it with a hint it said "any". 

 

Then I used typeName and it returned "" as empty. So it doesn't have a type and is not null? 

 

I don't understand what is happening I have used isNull previously (but inverse with !) but now I can't get it work. What is an any type?

Share this post


Link to post
Share on other sites

isNull only works if there is something that could be null. A variable that points to nothing at all is not null; it is undefined. To check if something is undefined, use isNil instead.

if (isNil "task05") then {...}

Alternatively, you could set up your task variables before actually creating all of your tasks; in this case, isNull could work. Some people will tell you that this is a better practice, although personally I don't think it makes any difference at all. Here's how you'd do that:

task05 = taskNull;
if (isNull task05) then {...};
Edited by st_dux

Share this post


Link to post
Share on other sites

Okay thanks must've been a fluke that it worked with the other one's. Probably because !isNull can still be something else i guess :p

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×