True/False Designscript weirdness

Why isn’t this outputting false?
true blatantly does not equal “Cancel”. :frowning:

Try just testing A[0] == "Cancel"; and see what you get.

I get true. :frowning:

@Alien ,

i think A is occupied by something…



meh… back to Python then :rofl:

Hi @Alien I guess it will work if you take string from object…seems it cant compare a system bool with a string…but not sure

1 Like

So the reason I asked this, is that I hoped it would trigger the indication that the root cause is lacing/replication guides, in particular that you can’t utilize them inside an if statement.

So what you need to do is ask “is the first item in A equal to the target?”
Then on the next line say “if that was true get me the true value; otherwise get me the false value.”

By running it as two actions you circumvent the limitation of the if statement.

It apparently is :roll_eyes:

But isn’t if you consider them to be two objects

So to solve your problem …

And miss the potentially awesome Design Script journey that lies ahead? :stuck_out_tongue_winking_eye:


Python > Designscript


This is because the “equal to” condition is truthy/falsy.


Sort of… Design Script (and therefore Dynamo) will attempt to convert to common types when doing comparison.
ie: 1.0 == 1;

This extends to booleans, where anything other than 0, “”, NaN, null, or other “empty” data types will convert to a value of true, as the object exists.


    Point.Origin() == True; //true
    "Turnip" == true; //true
    1 == true; //true
    Point.ByCoordinates("cat",0,0) == true; //false (maybe a warning instead)
    "" == true; //false
    0 == true; //false

It shows perfectly to not take things for granted. Computers do exactly what you tell them to do, not what you expect them to do…


This was my understanding of truthy/falsy. Is the only difference here that Design Script first attempts a conversion? So basically, Design Script does some cleanup/simplifying in order to compare like objects but then reverts to truthy/falsy when object types aren’t comparable?

if the objects are not the same type, it will attempt to convert them to the same type; Booleans are the most complex of the types. The design script language manual has a full chart (no link handy and I’m on my phone - sorry).

1 Like

For anybody else who’s interested.

3.4. Type conversion rules
DesignScriptGuide_.pdf (460.1 KB)