question

SudheerReddy avatar image
0 Likes"
SudheerReddy asked Matthew Gillespie answered

While loop working when test condition is a treen node

doubt.png

FlexSim 19.1.2
while loop
doubt.png (52.1 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered

From the user manual:

In general, to check if a treenode is null just compare the treenode with NULL or put it directly in an if statement. Note that the keyword nullvar represents a null Variant and is not the same as a null treenode.

treenode fred = model().find("doesnotexist");
return fred == NULL; // true
return fred == nullvar; // false
return tonum(fred); // 0
if (fred) return 1; else return 0; // 0
if (objectexists(fred)) return 1; else return 0; // 0

You should read the rest of the section under Null Values on this user manual page https://docs.flexsim.com/en/19.2/Reference/CodingInFlexSim/FlexScriptAPIReference/Tree/treenode.html..

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.